<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">

<title>class TypeProf::Scratch - typeprof: Ruby Standard Library Documentation</title>


<script src="../js/navigation.js" defer></script>
<script src="../js/search.js" defer></script>
<script src="../js/search_index.js" defer></script>
<script src="../js/searcher.js" defer></script>
<script src="../js/darkfish.js" defer></script>

<script src="../js/jquery-3.2.0.min.js"></script>

<script src="../js/vue.min.js"></script>
<script src="../js/js.cookie.min.js"></script>

<link href="../css/fonts.css" rel="stylesheet">
<link id='rdoccss' href="../css/rdoc.css" rel="stylesheet">
<link href="../css/carbon17.css" rel="stylesheet">

<script type="text/javascript">
  var rdoc_rel_prefix = "../";
  var index_rel_prefix = "../";
  var darkModeCsseHref = "../css/rdoc-dm.css"
  var defaultModeCssHref = "../css/rdoc.css"
  // var cssDarkmode = Cookies.get('darkmode');
  
  if( Cookies.get("darkmode") == "true") {
	$('#rdoccss').attr("href", darkModeCsseHref);
}

//  https://cssdeck.com/blog/simple-jquery-stylesheet-switcher/

document.write('<style type="text/css">body{display:none}</style>');

</script>


</head>
<body id="top" role="document" class="class">
  <!-- this is class.html -->

  <div id='actionbar' >
    <div class='wrapper mdiv'>
      <ul class='grids g0'></ul>
    </div> 
    <!-- VERSION HEADER for 3.3.0.preview2 NOT FOUND -->
  </div> <!-- end action bar -->

  <div class='wrapper hdiv'>

    


    <nav id='vapp' role="navigation">
    <div id="project-navigation">
      <div id="home-section" role="region" title="Quick navigation" class="nav-section">
  <h2><a href="../index.html" rel="home">Home</a></h2>

  <div id="table-of-contents-navigation"  >
    <a href="../table_of_contents.html#pages">Pages</a>
    <a href="../table_of_contents.html#classes">Classes</a>
    <a href="../table_of_contents.html#methods">Methods</a>
  </div>
</div>

      <div id="search-section" role="search" class="project-section initially-hidden">
  <form action="#" method="get" accept-charset="utf-8">
    <div id="search-field-wrapper">
      <input id="search-field" role="combobox" aria-label="Search"
             aria-autocomplete="list" aria-controls="search-results"
             type="text" name="search" placeholder="Search" spellcheck="false"
             title="Type to search, Up and Down to navigate, Enter to load">
    </div>

    <ul id="search-results" aria-label="Search Results"
        aria-busy="false" aria-expanded="false"
        aria-atomic="false" class="initially-hidden"></ul>
  </form>
</div>

    </div>


    

    <button id='toggleThing' @click="toggleNav()" >Show/hide navigation</button>
    <div :class="isOpen ? 'block' : 'hidden' " id='toggleMe'>
      <div id="class-metadata">
        
        
<div id="parent-class-section" class="nav-section">
  <h3>Parent</h3>

  <p class="link"><a href="../Object.html">Object</a>
</div>

        
        
        
<!-- Method Quickref -->
<div id="method-list-section" class="nav-section">
  <h3>Methods</h3>

  <ul class="link-list" role="directory">
    <li ><a href="#method-c-new">::new</a>
    <li ><a href="#method-i-add_attr_method">#add_attr_method</a>
    <li ><a href="#method-i-add_block_signature-21">#add_block_signature!</a>
    <li ><a href="#method-i-add_block_to_ctx-21">#add_block_to_ctx!</a>
    <li ><a href="#method-i-add_callsite-21">#add_callsite!</a>
    <li ><a href="#method-i-add_constant">#add_constant</a>
    <li ><a href="#method-i-add_cvar_read-21">#add_cvar_read!</a>
    <li ><a href="#method-i-add_cvar_write-21">#add_cvar_write!</a>
    <li ><a href="#method-i-add_edge">#add_edge</a>
    <li ><a href="#method-i-add_entrypoint">#add_entrypoint</a>
    <li ><a href="#method-i-add_executed_iseq">#add_executed_iseq</a>
    <li ><a href="#method-i-add_gvar_read-21">#add_gvar_read!</a>
    <li ><a href="#method-i-add_gvar_write-21">#add_gvar_write!</a>
    <li ><a href="#method-i-add_iseq_method">#add_iseq_method</a>
    <li ><a href="#method-i-add_iseq_method_call-21">#add_iseq_method_call!</a>
    <li ><a href="#method-i-add_ivar_read-21">#add_ivar_read!</a>
    <li ><a href="#method-i-add_ivar_write-21">#add_ivar_write!</a>
    <li ><a href="#method-i-add_method">#add_method</a>
    <li ><a href="#method-i-add_method_signature-21">#add_method_signature!</a>
    <li ><a href="#method-i-add_return_value-21">#add_return_value!</a>
    <li ><a href="#method-i-add_singleton_iseq_method">#add_singleton_iseq_method</a>
    <li ><a href="#method-i-add_superclass_type_args-21">#add_superclass_type_args!</a>
    <li ><a href="#method-i-add_typed_attr_method">#add_typed_attr_method</a>
    <li ><a href="#method-i-adjust_substitution">#adjust_substitution</a>
    <li ><a href="#method-i-alias_method">#alias_method</a>
    <li ><a href="#method-i-cbase_path">#cbase_path</a>
    <li ><a href="#method-i-check_typed_attr">#check_typed_attr</a>
    <li ><a href="#method-i-check_typed_method">#check_typed_method</a>
    <li ><a href="#method-i-do_define_iseq_method">#do_define_iseq_method</a>
    <li ><a href="#method-i-do_expand_array">#do_expand_array</a>
    <li ><a href="#method-i-do_invoke_block">#do_invoke_block</a>
    <li ><a href="#method-i-do_send">#do_send</a>
    <li ><a href="#method-i-error">#error</a>
    <li ><a href="#method-i-get_all_methods">#get_all_methods</a>
    <li ><a href="#method-i-get_all_super_methods">#get_all_super_methods</a>
    <li ><a href="#method-i-get_array_elem_type">#get_array_elem_type</a>
    <li ><a href="#method-i-get_class_name">#get_class_name</a>
    <li ><a href="#method-i-get_constant">#get_constant</a>
    <li ><a href="#method-i-get_container_elem_types">#get_container_elem_types</a>
    <li ><a href="#method-i-get_env">#get_env</a>
    <li ><a href="#method-i-get_hash_elem_type">#get_hash_elem_type</a>
    <li ><a href="#method-i-get_instance_variable">#get_instance_variable</a>
    <li ><a href="#method-i-get_ivar">#get_ivar</a>
    <li ><a href="#method-i-get_method">#get_method</a>
    <li ><a href="#method-i-get_super_method">#get_super_method</a>
    <li ><a href="#method-i-globalize_type">#globalize_type</a>
    <li ><a href="#method-i-identify_class_for_ivar">#identify_class_for_ivar</a>
    <li ><a href="#method-i-inspect">#inspect</a>
    <li ><a href="#method-i-localize_type">#localize_type</a>
    <li ><a href="#method-i-merge_env">#merge_env</a>
    <li ><a href="#method-i-merge_return_env">#merge_return_env</a>
    <li ><a href="#method-i-mix_module">#mix_module</a>
    <li ><a href="#method-i-new_class">#new_class</a>
    <li ><a href="#method-i-new_struct">#new_struct</a>
    <li ><a href="#method-i-pend_block_dummy_execution">#pend_block_dummy_execution</a>
    <li ><a href="#method-i-pend_method_execution">#pend_method_execution</a>
    <li ><a href="#method-i-report">#report</a>
    <li ><a href="#method-i-report_lsp">#report_lsp</a>
    <li ><a href="#method-i-reveal_type">#reveal_type</a>
    <li ><a href="#method-i-ruby_3_3_keywords-3F">#ruby_3_3_keywords?</a>
    <li ><a href="#method-i-search_constant">#search_constant</a>
    <li ><a href="#method-i-search_method">#search_method</a>
    <li ><a href="#method-i-set_custom_method">#set_custom_method</a>
    <li ><a href="#method-i-set_instance_variable">#set_instance_variable</a>
    <li ><a href="#method-i-set_method">#set_method</a>
    <li ><a href="#method-i-set_singleton_custom_method">#set_singleton_custom_method</a>
    <li ><a href="#method-i-setup_actual_arguments">#setup_actual_arguments</a>
    <li ><a href="#method-i-show_block_signature">#show_block_signature</a>
    <li ><a href="#method-i-show_method_signature">#show_method_signature</a>
    <li ><a href="#method-i-show_proc_signature">#show_proc_signature</a>
    <li ><a href="#method-i-step">#step</a>
    <li ><a href="#method-i-traverse_subclasses">#traverse_subclasses</a>
    <li ><a href="#method-i-type_profile">#type_profile</a>
    <li ><a href="#method-i-type_to_keywords">#type_to_keywords</a>
    <li ><a href="#method-i-update_container_elem_types">#update_container_elem_types</a>
    <li ><a href="#method-i-warn">#warn</a>
  </ul>
</div>

      </div>
     </div>
    </nav>


    <div id='extraz'><div class='adzbox-index'  >
      
     </div>         
    </div>

    <main role="main" aria-labelledby="class-TypeProf::Scratch">
    <h1 id="class-TypeProf::Scratch" class="class">
      class TypeProf::Scratch
    </h1>

    <section class="description">
    
    </section>

      <section id="5Buntitled-5D" class="documentation-section">



        <section class="attribute-method-details" class="method-section">
        <header>
        <h3>Attributes</h3>
        </header>

          <div id="attribute-i-class_defs" class="method-detail">
            <div class="method-heading attribute-method-heading">
              <span class="method-name">class_defs</span><span
                class="attribute-access-type">[R]</span>
            </div>

            <div class="method-description">
              
              </div>
            </div>
          <div id="attribute-i-loaded_files" class="method-detail">
            <div class="method-heading attribute-method-heading">
              <span class="method-name">loaded_files</span><span
                class="attribute-access-type">[R]</span>
            </div>

            <div class="method-description">
              
              </div>
            </div>
          <div id="attribute-i-namespace" class="method-detail">
            <div class="method-heading attribute-method-heading">
              <span class="method-name">namespace</span><span
                class="attribute-access-type">[RW]</span>
            </div>

            <div class="method-description">
              
              </div>
            </div>
          <div id="attribute-i-rbs_reader" class="method-detail">
            <div class="method-heading attribute-method-heading">
              <span class="method-name">rbs_reader</span><span
                class="attribute-access-type">[R]</span>
            </div>

            <div class="method-description">
              
              </div>
            </div>
          <div id="attribute-i-return_envs" class="method-detail">
            <div class="method-heading attribute-method-heading">
              <span class="method-name">return_envs</span><span
                class="attribute-access-type">[R]</span>
            </div>

            <div class="method-description">
              
              </div>
            </div>
            </section>


                <section id="public-class-5Buntitled-5D-method-details" class="method-section">
                <header>
                <h3>Public Class Methods</h3>
                </header>

                  <div id="method-c-new" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">new</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="new-source">
            <pre><span class="ruby-comment"># File typeprof-0.21.8/lib/typeprof/analyzer.rb, line 276</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">initialize</span>
  <span class="ruby-ivar">@entrypoints</span> = []

  <span class="ruby-ivar">@worklist</span> = <span class="ruby-constant">Utils</span><span class="ruby-operator">::</span><span class="ruby-constant">WorkList</span>.<span class="ruby-identifier">new</span>

  <span class="ruby-ivar">@ep2env</span> = {}

  <span class="ruby-ivar">@class_defs</span> = {}
  <span class="ruby-ivar">@struct_defs</span> = {}

  <span class="ruby-ivar">@iseq_method_to_ctxs</span> = {}

  <span class="ruby-ivar">@alloc_site_to_global_id</span> = {}

  <span class="ruby-ivar">@callsites</span>, <span class="ruby-ivar">@return_envs</span> = {}, {}
  <span class="ruby-ivar">@block_to_ctx</span> = {}
  <span class="ruby-ivar">@method_signatures</span> = {}
  <span class="ruby-ivar">@block_signatures</span> = {}
  <span class="ruby-ivar">@return_values</span> = {}
  <span class="ruby-ivar">@gvar_table</span> = <span class="ruby-constant">VarTable</span>.<span class="ruby-identifier">new</span>

  <span class="ruby-ivar">@errors</span> = []
  <span class="ruby-ivar">@reveal_types</span> = {}
  <span class="ruby-ivar">@backward_edges</span> = {}

  <span class="ruby-ivar">@pending_execution</span> = {}
  <span class="ruby-ivar">@executed_iseqs</span> = <span class="ruby-constant">Utils</span><span class="ruby-operator">::</span><span class="ruby-constant">MutableSet</span>.<span class="ruby-identifier">new</span>

  <span class="ruby-ivar">@loaded_files</span> = {}

  <span class="ruby-ivar">@rbs_reader</span> = <span class="ruby-constant">RBSReader</span>.<span class="ruby-identifier">new</span>

  <span class="ruby-ivar">@terminated</span> = <span class="ruby-keyword">false</span>

  <span class="ruby-ivar">@anonymous_struct_gen_id</span> = <span class="ruby-value">0</span>

  <span class="ruby-ivar">@types_being_shown</span> = []
  <span class="ruby-ivar">@namespace</span> = <span class="ruby-keyword">nil</span>

  <span class="ruby-ivar">@lsp_completion</span> = <span class="ruby-keyword">nil</span>
  <span class="ruby-ivar">@lsp_signature_help</span> = <span class="ruby-constant">CodeRangeTable</span>.<span class="ruby-identifier">new</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                          </section>

                <section id="public-instance-5Buntitled-5D-method-details" class="method-section">
                <header>
                <h3>Public Instance Methods</h3>
                </header>

                  <div id="method-i-add_attr_method" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">add_attr_method</span><span
                                class="method-args">(klass, mid, ivar, kind, pub_meth, ep)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="add_attr_method-source">
            <pre><span class="ruby-comment"># File typeprof-0.21.8/lib/typeprof/analyzer.rb, line 729</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">add_attr_method</span>(<span class="ruby-identifier">klass</span>, <span class="ruby-identifier">mid</span>, <span class="ruby-identifier">ivar</span>, <span class="ruby-identifier">kind</span>, <span class="ruby-identifier">pub_meth</span>, <span class="ruby-identifier">ep</span>)
  <span class="ruby-keyword">if</span> <span class="ruby-identifier">kind</span> <span class="ruby-operator">==</span> <span class="ruby-value">:reader</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">kind</span> <span class="ruby-operator">==</span> <span class="ruby-value">:accessor</span>
    <span class="ruby-identifier">typed_mdef</span> = <span class="ruby-identifier">check_typed_attr</span>(<span class="ruby-identifier">klass</span>, <span class="ruby-identifier">mid</span>, <span class="ruby-identifier">ep</span>.<span class="ruby-identifier">ctx</span>.<span class="ruby-identifier">cref</span>.<span class="ruby-identifier">singleton</span>)
    <span class="ruby-keyword">unless</span> <span class="ruby-identifier">typed_mdef</span>
      <span class="ruby-identifier">add_method</span>(<span class="ruby-identifier">klass</span>, <span class="ruby-identifier">mid</span>, <span class="ruby-keyword">false</span>, <span class="ruby-constant">ExecutedAttrMethodDef</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">ivar</span>, <span class="ruby-value">:reader</span>, <span class="ruby-identifier">pub_meth</span>, <span class="ruby-identifier">ep</span>))
    <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">if</span> <span class="ruby-identifier">kind</span> <span class="ruby-operator">==</span> <span class="ruby-value">:writer</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">kind</span> <span class="ruby-operator">==</span> <span class="ruby-value">:accessor</span>
    <span class="ruby-identifier">mid</span> = <span class="ruby-value">:&quot;#{ mid }=&quot;</span>
    <span class="ruby-identifier">typed_mdef</span> = <span class="ruby-identifier">check_typed_attr</span>(<span class="ruby-identifier">klass</span>, <span class="ruby-identifier">mid</span>, <span class="ruby-identifier">ep</span>.<span class="ruby-identifier">ctx</span>.<span class="ruby-identifier">cref</span>.<span class="ruby-identifier">singleton</span>)
    <span class="ruby-keyword">unless</span> <span class="ruby-identifier">typed_mdef</span>
      <span class="ruby-identifier">add_method</span>(<span class="ruby-identifier">klass</span>, <span class="ruby-identifier">mid</span>, <span class="ruby-keyword">false</span>, <span class="ruby-constant">ExecutedAttrMethodDef</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">ivar</span>, <span class="ruby-value">:writer</span>, <span class="ruby-identifier">pub_meth</span>, <span class="ruby-identifier">ep</span>))
    <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-add_block_signature-21" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">add_block_signature!</span><span
                                class="method-args">(block_body, bsig)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="add_block_signature-21-source">
            <pre><span class="ruby-comment"># File typeprof-0.21.8/lib/typeprof/analyzer.rb, line 841</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">add_block_signature!</span>(<span class="ruby-identifier">block_body</span>, <span class="ruby-identifier">bsig</span>)
  <span class="ruby-keyword">if</span> <span class="ruby-ivar">@block_signatures</span>[<span class="ruby-identifier">block_body</span>]
    <span class="ruby-ivar">@block_signatures</span>[<span class="ruby-identifier">block_body</span>] = <span class="ruby-ivar">@block_signatures</span>[<span class="ruby-identifier">block_body</span>].<span class="ruby-identifier">merge</span>(<span class="ruby-identifier">bsig</span>)
  <span class="ruby-keyword">else</span>
    <span class="ruby-ivar">@block_signatures</span>[<span class="ruby-identifier">block_body</span>] = <span class="ruby-identifier">bsig</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-add_block_to_ctx-21" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">add_block_to_ctx!</span><span
                                class="method-args">(block_body, ctx)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="add_block_to_ctx-21-source">
            <pre><span class="ruby-comment"># File typeprof-0.21.8/lib/typeprof/analyzer.rb, line 835</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">add_block_to_ctx!</span>(<span class="ruby-identifier">block_body</span>, <span class="ruby-identifier">ctx</span>)
  <span class="ruby-identifier">raise</span> <span class="ruby-keyword">if</span> <span class="ruby-operator">!</span><span class="ruby-identifier">block_body</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Block</span>)
  <span class="ruby-ivar">@block_to_ctx</span>[<span class="ruby-identifier">block_body</span>] <span class="ruby-operator">||=</span> <span class="ruby-constant">Utils</span><span class="ruby-operator">::</span><span class="ruby-constant">MutableSet</span>.<span class="ruby-identifier">new</span>
  <span class="ruby-ivar">@block_to_ctx</span>[<span class="ruby-identifier">block_body</span>] <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">ctx</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-add_callsite-21" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">add_callsite!</span><span
                                class="method-args">(callee_ctx, caller_ep, caller_env, &amp;ctn)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="add_callsite-21-source">
            <pre><span class="ruby-comment"># File typeprof-0.21.8/lib/typeprof/analyzer.rb, line 794</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">add_callsite!</span>(<span class="ruby-identifier">callee_ctx</span>, <span class="ruby-identifier">caller_ep</span>, <span class="ruby-identifier">caller_env</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">ctn</span>)
  <span class="ruby-keyword">if</span> <span class="ruby-identifier">callee_ctx</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Context</span>)
    <span class="ruby-ivar">@executed_iseqs</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">callee_ctx</span>.<span class="ruby-identifier">iseq</span>
    <span class="ruby-identifier">callee_type</span> = <span class="ruby-identifier">callee_ctx</span>.<span class="ruby-identifier">iseq</span>.<span class="ruby-identifier">type</span>
    <span class="ruby-keyword">if</span> <span class="ruby-identifier">caller_ep</span>.<span class="ruby-identifier">ctx</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Context</span>) <span class="ruby-operator">&amp;&amp;</span> (<span class="ruby-identifier">callee_type</span> <span class="ruby-operator">==</span> <span class="ruby-value">:method</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">callee_type</span> <span class="ruby-operator">==</span> <span class="ruby-value">:block</span>)
      <span class="ruby-identifier">caller_ep</span>.<span class="ruby-identifier">ctx</span>.<span class="ruby-identifier">iseq</span>&amp;.<span class="ruby-identifier">add_called_iseq</span>(<span class="ruby-identifier">caller_ep</span>.<span class="ruby-identifier">pc</span>, <span class="ruby-identifier">callee_ctx</span>.<span class="ruby-identifier">iseq</span>)
    <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">end</span>

  <span class="ruby-ivar">@callsites</span>[<span class="ruby-identifier">callee_ctx</span>] <span class="ruby-operator">||=</span> {}
  <span class="ruby-ivar">@callsites</span>[<span class="ruby-identifier">callee_ctx</span>][<span class="ruby-identifier">caller_ep</span>] = <span class="ruby-identifier">ctn</span>
  <span class="ruby-identifier">merge_return_env</span>(<span class="ruby-identifier">caller_ep</span>) {<span class="ruby-operator">|</span><span class="ruby-identifier">env</span><span class="ruby-operator">|</span> <span class="ruby-identifier">env</span> <span class="ruby-operator">?</span> <span class="ruby-identifier">env</span>.<span class="ruby-identifier">merge</span>(<span class="ruby-identifier">caller_env</span>) <span class="ruby-operator">:</span> <span class="ruby-identifier">caller_env</span> }

  <span class="ruby-identifier">ret_ty</span> = <span class="ruby-ivar">@return_values</span>[<span class="ruby-identifier">callee_ctx</span>] <span class="ruby-operator">||=</span> <span class="ruby-constant">Type</span>.<span class="ruby-identifier">bot</span>
  <span class="ruby-keyword">if</span> <span class="ruby-identifier">ret_ty</span> <span class="ruby-operator">!=</span> <span class="ruby-constant">Type</span>.<span class="ruby-identifier">bot</span>
    <span class="ruby-identifier">ctn</span>[<span class="ruby-identifier">ret_ty</span>, <span class="ruby-identifier">caller_ep</span>, <span class="ruby-ivar">@return_envs</span>[<span class="ruby-identifier">caller_ep</span>]]
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-add_constant" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">add_constant</span><span
                                class="method-args">(klass, name, value, def_ep)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="add_constant-source">
            <pre><span class="ruby-comment"># File typeprof-0.21.8/lib/typeprof/analyzer.rb, line 705</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">add_constant</span>(<span class="ruby-identifier">klass</span>, <span class="ruby-identifier">name</span>, <span class="ruby-identifier">value</span>, <span class="ruby-identifier">def_ep</span>)
  <span class="ruby-keyword">if</span> <span class="ruby-identifier">klass</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Type</span><span class="ruby-operator">::</span><span class="ruby-constant">Class</span>)
    <span class="ruby-ivar">@class_defs</span>[<span class="ruby-identifier">klass</span>.<span class="ruby-identifier">idx</span>].<span class="ruby-identifier">add_constant</span>(<span class="ruby-identifier">name</span>, <span class="ruby-identifier">value</span>, <span class="ruby-identifier">def_ep</span>)
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-add_cvar_read-21" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">add_cvar_read!</span><span
                                class="method-args">(klass, var, ep, &amp;ctn)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="add_cvar_read-21-source">
            <pre><span class="ruby-comment"># File typeprof-0.21.8/lib/typeprof/analyzer.rb, line 928</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">add_cvar_read!</span>(<span class="ruby-identifier">klass</span>, <span class="ruby-identifier">var</span>, <span class="ruby-identifier">ep</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">ctn</span>)
  <span class="ruby-identifier">klass</span>.<span class="ruby-identifier">each_child</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">klass</span><span class="ruby-operator">|</span>
    <span class="ruby-keyword">next</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">klass</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Type</span><span class="ruby-operator">::</span><span class="ruby-constant">Class</span>)
    <span class="ruby-identifier">class_def</span> = <span class="ruby-ivar">@class_defs</span>[<span class="ruby-identifier">klass</span>.<span class="ruby-identifier">idx</span>]
    <span class="ruby-keyword">next</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">class_def</span>
    <span class="ruby-identifier">class_def</span>.<span class="ruby-identifier">cvars</span>.<span class="ruby-identifier">add_read!</span>(<span class="ruby-identifier">var</span>, <span class="ruby-identifier">ep</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">ctn</span>)
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-add_cvar_write-21" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">add_cvar_write!</span><span
                                class="method-args">(klass, var, ty, ep)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="add_cvar_write-21-source">
            <pre><span class="ruby-comment"># File typeprof-0.21.8/lib/typeprof/analyzer.rb, line 937</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">add_cvar_write!</span>(<span class="ruby-identifier">klass</span>, <span class="ruby-identifier">var</span>, <span class="ruby-identifier">ty</span>, <span class="ruby-identifier">ep</span>)
  <span class="ruby-identifier">klass</span>.<span class="ruby-identifier">each_child</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">klass</span><span class="ruby-operator">|</span>
    <span class="ruby-keyword">next</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">klass</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Type</span><span class="ruby-operator">::</span><span class="ruby-constant">Class</span>)
    <span class="ruby-identifier">class_def</span> = <span class="ruby-ivar">@class_defs</span>[<span class="ruby-identifier">klass</span>.<span class="ruby-identifier">idx</span>]
    <span class="ruby-keyword">next</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">class_def</span>
    <span class="ruby-identifier">class_def</span>.<span class="ruby-identifier">cvars</span>.<span class="ruby-identifier">add_write!</span>(<span class="ruby-identifier">var</span>, <span class="ruby-identifier">ty</span>, <span class="ruby-identifier">ep</span>, <span class="ruby-keyword">self</span>)
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-add_edge" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">add_edge</span><span
                                class="method-args">(ep, next_ep)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="add_edge-source">
            <pre><span class="ruby-comment"># File typeprof-0.21.8/lib/typeprof/analyzer.rb, line 781</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">add_edge</span>(<span class="ruby-identifier">ep</span>, <span class="ruby-identifier">next_ep</span>)
  (<span class="ruby-ivar">@backward_edges</span>[<span class="ruby-identifier">next_ep</span>] <span class="ruby-operator">||=</span> {})[<span class="ruby-identifier">ep</span>] = <span class="ruby-keyword">true</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-add_entrypoint" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">add_entrypoint</span><span
                                class="method-args">(iseq)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="add_entrypoint-source">
            <pre><span class="ruby-comment"># File typeprof-0.21.8/lib/typeprof/analyzer.rb, line 319</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">add_entrypoint</span>(<span class="ruby-identifier">iseq</span>)
  <span class="ruby-ivar">@entrypoints</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">iseq</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-add_executed_iseq" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">add_executed_iseq</span><span
                                class="method-args">(iseq)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="add_executed_iseq-source">
            <pre><span class="ruby-comment"># File typeprof-0.21.8/lib/typeprof/analyzer.rb, line 790</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">add_executed_iseq</span>(<span class="ruby-identifier">iseq</span>)
  <span class="ruby-ivar">@executed_iseqs</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">iseq</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-add_gvar_read-21" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">add_gvar_read!</span><span
                                class="method-args">(var, ep, &amp;ctn)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="add_gvar_read-21-source">
            <pre><span class="ruby-comment"># File typeprof-0.21.8/lib/typeprof/analyzer.rb, line 946</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">add_gvar_read!</span>(<span class="ruby-identifier">var</span>, <span class="ruby-identifier">ep</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">ctn</span>)
  <span class="ruby-ivar">@gvar_table</span>.<span class="ruby-identifier">add_read!</span>(<span class="ruby-identifier">var</span>, <span class="ruby-identifier">ep</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">ctn</span>)
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-add_gvar_write-21" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">add_gvar_write!</span><span
                                class="method-args">(var, ty, ep)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="add_gvar_write-21-source">
            <pre><span class="ruby-comment"># File typeprof-0.21.8/lib/typeprof/analyzer.rb, line 950</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">add_gvar_write!</span>(<span class="ruby-identifier">var</span>, <span class="ruby-identifier">ty</span>, <span class="ruby-identifier">ep</span>)
  <span class="ruby-ivar">@gvar_table</span>.<span class="ruby-identifier">add_write!</span>(<span class="ruby-identifier">var</span>, <span class="ruby-identifier">ty</span>, <span class="ruby-identifier">ep</span>, <span class="ruby-keyword">self</span>)
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-add_iseq_method" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">add_iseq_method</span><span
                                class="method-args">(klass, mid, iseq, cref, outer_ep, pub_meth)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="add_iseq_method-source">
            <pre><span class="ruby-comment"># File typeprof-0.21.8/lib/typeprof/analyzer.rb, line 751</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">add_iseq_method</span>(<span class="ruby-identifier">klass</span>, <span class="ruby-identifier">mid</span>, <span class="ruby-identifier">iseq</span>, <span class="ruby-identifier">cref</span>, <span class="ruby-identifier">outer_ep</span>, <span class="ruby-identifier">pub_meth</span>)
  <span class="ruby-identifier">add_method</span>(<span class="ruby-identifier">klass</span>, <span class="ruby-identifier">mid</span>, <span class="ruby-keyword">false</span>, <span class="ruby-constant">ISeqMethodDef</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">iseq</span>, <span class="ruby-identifier">cref</span>, <span class="ruby-identifier">outer_ep</span>, <span class="ruby-identifier">pub_meth</span>))
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-add_iseq_method_call-21" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">add_iseq_method_call!</span><span
                                class="method-args">(iseq_mdef, ctx)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="add_iseq_method_call-21-source">
            <pre><span class="ruby-comment"># File typeprof-0.21.8/lib/typeprof/analyzer.rb, line 785</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">add_iseq_method_call!</span>(<span class="ruby-identifier">iseq_mdef</span>, <span class="ruby-identifier">ctx</span>)
  <span class="ruby-ivar">@iseq_method_to_ctxs</span>[<span class="ruby-identifier">iseq_mdef</span>] <span class="ruby-operator">||=</span> <span class="ruby-constant">Utils</span><span class="ruby-operator">::</span><span class="ruby-constant">MutableSet</span>.<span class="ruby-identifier">new</span>
  <span class="ruby-ivar">@iseq_method_to_ctxs</span>[<span class="ruby-identifier">iseq_mdef</span>] <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">ctx</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-add_ivar_read-21" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">add_ivar_read!</span><span
                                class="method-args">(recv, var, ep, &amp;ctn)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="add_ivar_read-21-source">
            <pre><span class="ruby-comment"># File typeprof-0.21.8/lib/typeprof/analyzer.rb, line 911</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">add_ivar_read!</span>(<span class="ruby-identifier">recv</span>, <span class="ruby-identifier">var</span>, <span class="ruby-identifier">ep</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">ctn</span>)
  <span class="ruby-identifier">recv</span>.<span class="ruby-identifier">each_child</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">recv</span><span class="ruby-operator">|</span>
    <span class="ruby-identifier">class_def</span>, <span class="ruby-identifier">singleton</span> = <span class="ruby-identifier">get_ivar</span>(<span class="ruby-identifier">recv</span>, <span class="ruby-identifier">var</span>)
    <span class="ruby-keyword">next</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">class_def</span>
    <span class="ruby-identifier">class_def</span>.<span class="ruby-identifier">ivars</span>.<span class="ruby-identifier">add_read!</span>([<span class="ruby-identifier">singleton</span>, <span class="ruby-identifier">var</span>], <span class="ruby-identifier">ep</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">ctn</span>)
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-add_ivar_write-21" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">add_ivar_write!</span><span
                                class="method-args">(recv, var, ty, ep)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="add_ivar_write-21-source">
            <pre><span class="ruby-comment"># File typeprof-0.21.8/lib/typeprof/analyzer.rb, line 919</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">add_ivar_write!</span>(<span class="ruby-identifier">recv</span>, <span class="ruby-identifier">var</span>, <span class="ruby-identifier">ty</span>, <span class="ruby-identifier">ep</span>)
  <span class="ruby-identifier">recv</span>.<span class="ruby-identifier">each_child</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">recv</span><span class="ruby-operator">|</span>
    <span class="ruby-identifier">class_def</span>, <span class="ruby-identifier">singleton</span> = <span class="ruby-identifier">get_ivar</span>(<span class="ruby-identifier">recv</span>, <span class="ruby-identifier">var</span>)
    <span class="ruby-keyword">next</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">class_def</span>
    <span class="ruby-identifier">site</span> = [<span class="ruby-identifier">singleton</span>, <span class="ruby-identifier">var</span>]
    <span class="ruby-identifier">class_def</span>.<span class="ruby-identifier">ivars</span>.<span class="ruby-identifier">add_write!</span>(<span class="ruby-identifier">site</span>, <span class="ruby-identifier">ty</span>, <span class="ruby-identifier">ep</span>, <span class="ruby-keyword">self</span>)
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-add_method" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">add_method</span><span
                                class="method-args">(klass, mid, singleton, mdef)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="add_method-source">
            <pre><span class="ruby-comment"># File typeprof-0.21.8/lib/typeprof/analyzer.rb, line 719</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">add_method</span>(<span class="ruby-identifier">klass</span>, <span class="ruby-identifier">mid</span>, <span class="ruby-identifier">singleton</span>, <span class="ruby-identifier">mdef</span>)
  <span class="ruby-ivar">@class_defs</span>[<span class="ruby-identifier">klass</span>.<span class="ruby-identifier">idx</span>].<span class="ruby-identifier">add_method</span>(<span class="ruby-identifier">mid</span>, <span class="ruby-identifier">singleton</span>, <span class="ruby-identifier">mdef</span>)
  <span class="ruby-identifier">mdef</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-add_method_signature-21" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">add_method_signature!</span><span
                                class="method-args">(callee_ctx, msig)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="add_method_signature-21-source">
            <pre><span class="ruby-comment"># File typeprof-0.21.8/lib/typeprof/analyzer.rb, line 813</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">add_method_signature!</span>(<span class="ruby-identifier">callee_ctx</span>, <span class="ruby-identifier">msig</span>)
  <span class="ruby-keyword">if</span> <span class="ruby-ivar">@method_signatures</span>[<span class="ruby-identifier">callee_ctx</span>]
    <span class="ruby-ivar">@method_signatures</span>[<span class="ruby-identifier">callee_ctx</span>] = <span class="ruby-ivar">@method_signatures</span>[<span class="ruby-identifier">callee_ctx</span>].<span class="ruby-identifier">merge</span>(<span class="ruby-identifier">msig</span>)
  <span class="ruby-keyword">else</span>
    <span class="ruby-ivar">@method_signatures</span>[<span class="ruby-identifier">callee_ctx</span>] = <span class="ruby-identifier">msig</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-add_return_value-21" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">add_return_value!</span><span
                                class="method-args">(callee_ctx, ret_ty)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="add_return_value-21-source">
            <pre><span class="ruby-comment"># File typeprof-0.21.8/lib/typeprof/analyzer.rb, line 825</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">add_return_value!</span>(<span class="ruby-identifier">callee_ctx</span>, <span class="ruby-identifier">ret_ty</span>)
  <span class="ruby-ivar">@return_values</span>[<span class="ruby-identifier">callee_ctx</span>] <span class="ruby-operator">||=</span> <span class="ruby-constant">Type</span>.<span class="ruby-identifier">bot</span>
  <span class="ruby-ivar">@return_values</span>[<span class="ruby-identifier">callee_ctx</span>] = <span class="ruby-ivar">@return_values</span>[<span class="ruby-identifier">callee_ctx</span>].<span class="ruby-identifier">union</span>(<span class="ruby-identifier">ret_ty</span>)

  <span class="ruby-ivar">@callsites</span>[<span class="ruby-identifier">callee_ctx</span>] <span class="ruby-operator">||=</span> {}
  <span class="ruby-ivar">@callsites</span>[<span class="ruby-identifier">callee_ctx</span>].<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">caller_ep</span>, <span class="ruby-identifier">ctn</span><span class="ruby-operator">|</span>
    <span class="ruby-identifier">ctn</span>[<span class="ruby-identifier">ret_ty</span>, <span class="ruby-identifier">caller_ep</span>, <span class="ruby-ivar">@return_envs</span>[<span class="ruby-identifier">caller_ep</span>]]
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-add_singleton_iseq_method" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">add_singleton_iseq_method</span><span
                                class="method-args">(klass, mid, iseq, cref, outer_ep, pub_meth)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="add_singleton_iseq_method-source">
            <pre><span class="ruby-comment"># File typeprof-0.21.8/lib/typeprof/analyzer.rb, line 755</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">add_singleton_iseq_method</span>(<span class="ruby-identifier">klass</span>, <span class="ruby-identifier">mid</span>, <span class="ruby-identifier">iseq</span>, <span class="ruby-identifier">cref</span>, <span class="ruby-identifier">outer_ep</span>, <span class="ruby-identifier">pub_meth</span>)
  <span class="ruby-identifier">add_method</span>(<span class="ruby-identifier">klass</span>, <span class="ruby-identifier">mid</span>, <span class="ruby-keyword">true</span>, <span class="ruby-constant">ISeqMethodDef</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">iseq</span>, <span class="ruby-identifier">cref</span>, <span class="ruby-identifier">outer_ep</span>, <span class="ruby-identifier">pub_meth</span>))
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-add_superclass_type_args-21" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">add_superclass_type_args!</span><span
                                class="method-args">(klass, tyargs)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="add_superclass_type_args-21-source">
            <pre><span class="ruby-comment"># File typeprof-0.21.8/lib/typeprof/analyzer.rb, line 524</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">add_superclass_type_args!</span>(<span class="ruby-identifier">klass</span>, <span class="ruby-identifier">tyargs</span>)
  <span class="ruby-identifier">klass</span>.<span class="ruby-identifier">superclass_type_args</span> = <span class="ruby-identifier">tyargs</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-add_typed_attr_method" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">add_typed_attr_method</span><span
                                class="method-args">(klass, mdef)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="add_typed_attr_method-source">
            <pre><span class="ruby-comment"># File typeprof-0.21.8/lib/typeprof/analyzer.rb, line 745</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">add_typed_attr_method</span>(<span class="ruby-identifier">klass</span>, <span class="ruby-identifier">mdef</span>)
  <span class="ruby-identifier">name</span> = <span class="ruby-identifier">mdef</span>.<span class="ruby-identifier">ivar</span>[<span class="ruby-value">1</span><span class="ruby-operator">..</span><span class="ruby-value">-1</span>]
  <span class="ruby-identifier">name</span> = <span class="ruby-identifier">mdef</span>.<span class="ruby-identifier">kind</span> <span class="ruby-operator">==</span> <span class="ruby-value">:writer</span> <span class="ruby-operator">?</span> <span class="ruby-value">:&quot;#{ name }=&quot;</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">name</span>.<span class="ruby-identifier">to_sym</span>
  <span class="ruby-identifier">add_method</span>(<span class="ruby-identifier">klass</span>, <span class="ruby-identifier">name</span>, <span class="ruby-keyword">false</span>, <span class="ruby-identifier">mdef</span>)
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-adjust_substitution" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">adjust_substitution</span><span
                                class="method-args">(klass, singleton, mid, mthd, subst, &amp;blk)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="adjust_substitution-source">
            <pre><span class="ruby-comment"># File typeprof-0.21.8/lib/typeprof/analyzer.rb, line 568</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">adjust_substitution</span>(<span class="ruby-identifier">klass</span>, <span class="ruby-identifier">singleton</span>, <span class="ruby-identifier">mid</span>, <span class="ruby-identifier">mthd</span>, <span class="ruby-identifier">subst</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">blk</span>)
  <span class="ruby-identifier">direct</span> = <span class="ruby-keyword">true</span>
  <span class="ruby-keyword">if</span> <span class="ruby-identifier">klass</span>.<span class="ruby-identifier">kind</span> <span class="ruby-operator">==</span> <span class="ruby-value">:class</span>
    <span class="ruby-keyword">while</span> <span class="ruby-identifier">klass</span> <span class="ruby-operator">!=</span> <span class="ruby-value">:__root__</span>
      <span class="ruby-identifier">class_def</span> = <span class="ruby-ivar">@class_defs</span>[<span class="ruby-identifier">klass</span>.<span class="ruby-identifier">idx</span>]
      <span class="ruby-identifier">class_def</span>.<span class="ruby-identifier">adjust_substitution</span>(<span class="ruby-identifier">singleton</span>, <span class="ruby-identifier">mid</span>, <span class="ruby-identifier">mthd</span>, <span class="ruby-identifier">subst</span>, <span class="ruby-identifier">direct</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">blk</span>)
      <span class="ruby-identifier">direct</span> = <span class="ruby-keyword">false</span>
      <span class="ruby-keyword">if</span> <span class="ruby-identifier">klass</span>.<span class="ruby-identifier">superclass</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">klass</span>.<span class="ruby-identifier">superclass_type_args</span>
        <span class="ruby-identifier">subst2</span> = {}
        <span class="ruby-identifier">klass</span>.<span class="ruby-identifier">superclass</span>.<span class="ruby-identifier">type_params</span>.<span class="ruby-identifier">zip</span>(<span class="ruby-identifier">klass</span>.<span class="ruby-identifier">superclass_type_args</span>) <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span>(<span class="ruby-identifier">tyvar</span>, <span class="ruby-operator">*</span>), <span class="ruby-identifier">tyarg</span><span class="ruby-operator">|</span>
          <span class="ruby-identifier">tyvar</span> = <span class="ruby-constant">Type</span><span class="ruby-operator">::</span><span class="ruby-constant">Var</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">tyvar</span>)
          <span class="ruby-identifier">subst2</span>[<span class="ruby-identifier">tyvar</span>] = <span class="ruby-identifier">tyarg</span>.<span class="ruby-identifier">substitute</span>(<span class="ruby-identifier">subst</span>, <span class="ruby-constant">Config</span>.<span class="ruby-identifier">current</span>.<span class="ruby-identifier">options</span>[<span class="ruby-value">:type_depth_limit</span>])
        <span class="ruby-keyword">end</span>
        <span class="ruby-identifier">subst</span> = <span class="ruby-identifier">subst2</span>
      <span class="ruby-keyword">end</span>
      <span class="ruby-identifier">klass</span> = <span class="ruby-identifier">klass</span>.<span class="ruby-identifier">superclass</span>
    <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">else</span>
    <span class="ruby-comment"># module</span>
    <span class="ruby-identifier">class_def</span> = <span class="ruby-ivar">@class_defs</span>[<span class="ruby-identifier">klass</span>.<span class="ruby-identifier">idx</span>]
    <span class="ruby-identifier">class_def</span>.<span class="ruby-identifier">adjust_substitution</span>(<span class="ruby-identifier">singleton</span>, <span class="ruby-identifier">mid</span>, <span class="ruby-identifier">mthd</span>, <span class="ruby-identifier">subst</span>, <span class="ruby-identifier">direct</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">blk</span>)
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-alias_method" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">alias_method</span><span
                                class="method-args">(klass, singleton, alias_mid, orig_mid, ep)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="alias_method-source">
            <pre><span class="ruby-comment"># File typeprof-0.21.8/lib/typeprof/analyzer.rb, line 767</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">alias_method</span>(<span class="ruby-identifier">klass</span>, <span class="ruby-identifier">singleton</span>, <span class="ruby-identifier">alias_mid</span>, <span class="ruby-identifier">orig_mid</span>, <span class="ruby-identifier">ep</span>)
  <span class="ruby-keyword">if</span> <span class="ruby-identifier">klass</span> <span class="ruby-operator">==</span> <span class="ruby-constant">Type</span>.<span class="ruby-identifier">any</span>
    <span class="ruby-keyword">self</span>
  <span class="ruby-keyword">else</span>
    <span class="ruby-identifier">mdefs</span> = <span class="ruby-identifier">get_method</span>(<span class="ruby-identifier">klass</span>, <span class="ruby-identifier">singleton</span>, <span class="ruby-keyword">false</span>, <span class="ruby-identifier">orig_mid</span>) <span class="ruby-comment"># XXX: include_subclass == false??</span>
    <span class="ruby-keyword">if</span> <span class="ruby-identifier">mdefs</span>
      <span class="ruby-comment"># dup is needed for `alias foo foo` (otherwise, &quot;can&#39;t add a new key into hash during iteration&quot; error occurs)</span>
      <span class="ruby-identifier">mdefs</span>.<span class="ruby-identifier">dup</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">mdef</span><span class="ruby-operator">|</span>
        <span class="ruby-ivar">@class_defs</span>[<span class="ruby-identifier">klass</span>.<span class="ruby-identifier">idx</span>].<span class="ruby-identifier">add_method</span>(<span class="ruby-identifier">alias_mid</span>, <span class="ruby-identifier">singleton</span>, <span class="ruby-constant">AliasMethodDef</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">orig_mid</span>, <span class="ruby-identifier">mdef</span>, <span class="ruby-identifier">ep</span>))
      <span class="ruby-keyword">end</span>
    <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-cbase_path" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">cbase_path</span><span
                                class="method-args">(cbase)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="cbase_path-source">
            <pre><span class="ruby-comment"># File typeprof-0.21.8/lib/typeprof/analyzer.rb, line 498</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">cbase_path</span>(<span class="ruby-identifier">cbase</span>)
  <span class="ruby-identifier">cbase</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">cbase</span>.<span class="ruby-identifier">idx</span> <span class="ruby-operator">!=</span> <span class="ruby-value">1</span> <span class="ruby-operator">?</span> <span class="ruby-ivar">@class_defs</span>[<span class="ruby-identifier">cbase</span>.<span class="ruby-identifier">idx</span>].<span class="ruby-identifier">name</span> <span class="ruby-operator">:</span> []
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-check_typed_attr" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">check_typed_attr</span><span
                                class="method-args">(klass, mid, singleton)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="check_typed_attr-source">
            <pre><span class="ruby-comment"># File typeprof-0.21.8/lib/typeprof/analyzer.rb, line 715</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">check_typed_attr</span>(<span class="ruby-identifier">klass</span>, <span class="ruby-identifier">mid</span>, <span class="ruby-identifier">singleton</span>)
  <span class="ruby-ivar">@class_defs</span>[<span class="ruby-identifier">klass</span>.<span class="ruby-identifier">idx</span>].<span class="ruby-identifier">check_typed_attr</span>(<span class="ruby-identifier">mid</span>, <span class="ruby-identifier">singleton</span>)
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-check_typed_method" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">check_typed_method</span><span
                                class="method-args">(klass, mid, singleton)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="check_typed_method-source">
            <pre><span class="ruby-comment"># File typeprof-0.21.8/lib/typeprof/analyzer.rb, line 711</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">check_typed_method</span>(<span class="ruby-identifier">klass</span>, <span class="ruby-identifier">mid</span>, <span class="ruby-identifier">singleton</span>)
  <span class="ruby-ivar">@class_defs</span>[<span class="ruby-identifier">klass</span>.<span class="ruby-identifier">idx</span>].<span class="ruby-identifier">check_typed_method</span>(<span class="ruby-identifier">mid</span>, <span class="ruby-identifier">singleton</span>)
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-do_define_iseq_method" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">do_define_iseq_method</span><span
                                class="method-args">(ep, env, mid, iseq, outer_ep)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="do_define_iseq_method-source">
            <pre><span class="ruby-comment"># File typeprof-0.21.8/lib/typeprof/analyzer.rb, line 2473</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">do_define_iseq_method</span>(<span class="ruby-identifier">ep</span>, <span class="ruby-identifier">env</span>, <span class="ruby-identifier">mid</span>, <span class="ruby-identifier">iseq</span>, <span class="ruby-identifier">outer_ep</span>)
  <span class="ruby-identifier">cref</span> = <span class="ruby-identifier">ep</span>.<span class="ruby-identifier">ctx</span>.<span class="ruby-identifier">cref</span>
  <span class="ruby-keyword">if</span> <span class="ruby-identifier">cref</span>.<span class="ruby-identifier">klass</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Type</span><span class="ruby-operator">::</span><span class="ruby-constant">Class</span>)
    <span class="ruby-identifier">typed_mdef</span> = <span class="ruby-identifier">check_typed_method</span>(<span class="ruby-identifier">cref</span>.<span class="ruby-identifier">klass</span>, <span class="ruby-identifier">mid</span>, <span class="ruby-identifier">ep</span>.<span class="ruby-identifier">ctx</span>.<span class="ruby-identifier">cref</span>.<span class="ruby-identifier">singleton</span>)
    <span class="ruby-identifier">recv</span> = <span class="ruby-identifier">cref</span>.<span class="ruby-identifier">klass</span>
    <span class="ruby-identifier">recv</span> = <span class="ruby-constant">Type</span><span class="ruby-operator">::</span><span class="ruby-constant">Instance</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">recv</span>) <span class="ruby-keyword">unless</span> <span class="ruby-identifier">ep</span>.<span class="ruby-identifier">ctx</span>.<span class="ruby-identifier">cref</span>.<span class="ruby-identifier">singleton</span>
    <span class="ruby-keyword">if</span> <span class="ruby-identifier">typed_mdef</span>
      <span class="ruby-identifier">mdef</span> = <span class="ruby-constant">ISeqMethodDef</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">iseq</span>, <span class="ruby-identifier">cref</span>, <span class="ruby-identifier">outer_ep</span>, <span class="ruby-identifier">env</span>.<span class="ruby-identifier">static_env</span>.<span class="ruby-identifier">pub_meth</span>)
      <span class="ruby-identifier">typed_mdef</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">typed_mdef</span><span class="ruby-operator">|</span>
        <span class="ruby-identifier">typed_mdef</span>.<span class="ruby-identifier">do_match_iseq_mdef</span>(<span class="ruby-identifier">mdef</span>, <span class="ruby-identifier">recv</span>, <span class="ruby-identifier">mid</span>, <span class="ruby-identifier">env</span>, <span class="ruby-identifier">ep</span>, <span class="ruby-keyword">self</span>)
      <span class="ruby-keyword">end</span>
    <span class="ruby-keyword">else</span>
      <span class="ruby-keyword">if</span> <span class="ruby-identifier">ep</span>.<span class="ruby-identifier">ctx</span>.<span class="ruby-identifier">cref</span>.<span class="ruby-identifier">singleton</span>
        <span class="ruby-identifier">meth</span> = <span class="ruby-identifier">add_singleton_iseq_method</span>(<span class="ruby-identifier">cref</span>.<span class="ruby-identifier">klass</span>, <span class="ruby-identifier">mid</span>, <span class="ruby-identifier">iseq</span>, <span class="ruby-identifier">cref</span>, <span class="ruby-identifier">outer_ep</span>, <span class="ruby-keyword">true</span>)
      <span class="ruby-keyword">else</span>
        <span class="ruby-identifier">meth</span> = <span class="ruby-identifier">add_iseq_method</span>(<span class="ruby-identifier">cref</span>.<span class="ruby-identifier">klass</span>, <span class="ruby-identifier">mid</span>, <span class="ruby-identifier">iseq</span>, <span class="ruby-identifier">cref</span>, <span class="ruby-identifier">outer_ep</span>, <span class="ruby-identifier">env</span>.<span class="ruby-identifier">static_env</span>.<span class="ruby-identifier">pub_meth</span>)
        <span class="ruby-keyword">if</span> <span class="ruby-identifier">env</span>.<span class="ruby-identifier">static_env</span>.<span class="ruby-identifier">mod_func</span>
          <span class="ruby-identifier">add_singleton_iseq_method</span>(<span class="ruby-identifier">cref</span>.<span class="ruby-identifier">klass</span>, <span class="ruby-identifier">mid</span>, <span class="ruby-identifier">iseq</span>, <span class="ruby-identifier">cref</span>, <span class="ruby-identifier">outer_ep</span>, <span class="ruby-keyword">true</span>)
        <span class="ruby-keyword">end</span>
      <span class="ruby-keyword">end</span>
    <span class="ruby-keyword">end</span>

    <span class="ruby-identifier">pend_method_execution</span>(<span class="ruby-identifier">iseq</span>, <span class="ruby-identifier">meth</span>, <span class="ruby-identifier">recv</span>, <span class="ruby-identifier">mid</span>, <span class="ruby-identifier">ep</span>.<span class="ruby-identifier">ctx</span>.<span class="ruby-identifier">cref</span>, <span class="ruby-identifier">outer_ep</span>)
  <span class="ruby-keyword">else</span>
    <span class="ruby-comment"># XXX: what to do?</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-do_invoke_block" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">do_invoke_block</span><span
                                class="method-args">(blk, aargs, ep, env, replace_recv_ty: nil, replace_cref: nil, &amp;ctn)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="do_invoke_block-source">
            <pre><span class="ruby-comment"># File typeprof-0.21.8/lib/typeprof/analyzer.rb, line 2462</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">do_invoke_block</span>(<span class="ruby-identifier">blk</span>, <span class="ruby-identifier">aargs</span>, <span class="ruby-identifier">ep</span>, <span class="ruby-identifier">env</span>, <span class="ruby-value">replace_recv_ty:</span> <span class="ruby-keyword">nil</span>, <span class="ruby-value">replace_cref:</span> <span class="ruby-keyword">nil</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">ctn</span>)
  <span class="ruby-identifier">blk</span>.<span class="ruby-identifier">each_child</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">blk</span><span class="ruby-operator">|</span>
    <span class="ruby-keyword">if</span> <span class="ruby-identifier">blk</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Type</span><span class="ruby-operator">::</span><span class="ruby-constant">Proc</span>)
      <span class="ruby-identifier">blk</span>.<span class="ruby-identifier">block_body</span>.<span class="ruby-identifier">do_call</span>(<span class="ruby-identifier">aargs</span>, <span class="ruby-identifier">ep</span>, <span class="ruby-identifier">env</span>, <span class="ruby-keyword">self</span>, <span class="ruby-value">replace_recv_ty:</span> <span class="ruby-identifier">replace_recv_ty</span>, <span class="ruby-value">replace_cref:</span> <span class="ruby-identifier">replace_cref</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">ctn</span>)
    <span class="ruby-keyword">else</span>
      <span class="ruby-identifier">warn</span>(<span class="ruby-identifier">ep</span>, <span class="ruby-string">&quot;non-proc is passed as a block&quot;</span>) <span class="ruby-keyword">if</span> <span class="ruby-identifier">blk</span> <span class="ruby-operator">!=</span> <span class="ruby-constant">Type</span>.<span class="ruby-identifier">any</span>
      <span class="ruby-identifier">ctn</span>[<span class="ruby-constant">Type</span>.<span class="ruby-identifier">any</span>, <span class="ruby-identifier">ep</span>, <span class="ruby-identifier">env</span>]
    <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-do_send" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">do_send</span><span
                                class="method-args">(recvs, mid, aargs, ep, env, &amp;ctn)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="do_send-source">
            <pre><span class="ruby-comment"># File typeprof-0.21.8/lib/typeprof/analyzer.rb, line 2404</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">do_send</span>(<span class="ruby-identifier">recvs</span>, <span class="ruby-identifier">mid</span>, <span class="ruby-identifier">aargs</span>, <span class="ruby-identifier">ep</span>, <span class="ruby-identifier">env</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">ctn</span>)
  <span class="ruby-keyword">if</span> <span class="ruby-identifier">mid</span> <span class="ruby-operator">==</span> <span class="ruby-value">:__typeprof_lsp_completion</span>
    <span class="ruby-identifier">names</span> = {}
    <span class="ruby-identifier">recvs</span>.<span class="ruby-identifier">each_child</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">recv</span><span class="ruby-operator">|</span>
      <span class="ruby-keyword">case</span> <span class="ruby-identifier">recv</span>
      <span class="ruby-keyword">when</span> <span class="ruby-constant">Type</span><span class="ruby-operator">::</span><span class="ruby-constant">Void</span>, <span class="ruby-constant">Type</span><span class="ruby-operator">::</span><span class="ruby-constant">Any</span>
      <span class="ruby-keyword">else</span>
        <span class="ruby-identifier">klass</span>, <span class="ruby-identifier">singleton</span>, <span class="ruby-identifier">include_subclasses</span> = <span class="ruby-identifier">recv</span>.<span class="ruby-identifier">method_dispatch_info</span>
        <span class="ruby-identifier">names</span>.<span class="ruby-identifier">merge!</span>(<span class="ruby-identifier">get_all_methods</span>(<span class="ruby-identifier">klass</span>, <span class="ruby-identifier">singleton</span>, <span class="ruby-identifier">include_subclasses</span>)) <span class="ruby-keyword">if</span> <span class="ruby-identifier">klass</span>
      <span class="ruby-keyword">end</span>
    <span class="ruby-keyword">end</span>
    <span class="ruby-ivar">@lsp_completion</span> = <span class="ruby-identifier">names</span>
    <span class="ruby-keyword">return</span> <span class="ruby-identifier">ctn</span>[<span class="ruby-constant">Type</span>.<span class="ruby-identifier">any</span>, <span class="ruby-identifier">ep</span>, <span class="ruby-identifier">env</span>]
  <span class="ruby-keyword">end</span>

  <span class="ruby-identifier">recvs</span>.<span class="ruby-identifier">each_child</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">recv</span><span class="ruby-operator">|</span>
    <span class="ruby-keyword">case</span> <span class="ruby-identifier">recv</span>
    <span class="ruby-keyword">when</span> <span class="ruby-constant">Type</span><span class="ruby-operator">::</span><span class="ruby-constant">Void</span>
      <span class="ruby-identifier">error</span>(<span class="ruby-identifier">ep</span>, <span class="ruby-node">&quot;void&#39;s method is called: #{ globalize_type(recv, env, ep).screen_name(self) }##{ mid }&quot;</span>)
      <span class="ruby-identifier">ctn</span>[<span class="ruby-constant">Type</span>.<span class="ruby-identifier">any</span>, <span class="ruby-identifier">ep</span>, <span class="ruby-identifier">env</span>]
    <span class="ruby-keyword">when</span> <span class="ruby-constant">Type</span><span class="ruby-operator">::</span><span class="ruby-constant">Any</span>
      <span class="ruby-identifier">ctn</span>[<span class="ruby-constant">Type</span>.<span class="ruby-identifier">any</span>, <span class="ruby-identifier">ep</span>, <span class="ruby-identifier">env</span>]
    <span class="ruby-keyword">else</span>
      <span class="ruby-identifier">klass</span>, <span class="ruby-identifier">singleton</span>, <span class="ruby-identifier">include_subclasses</span> = <span class="ruby-identifier">recv</span>.<span class="ruby-identifier">method_dispatch_info</span>
      <span class="ruby-identifier">meths</span> = <span class="ruby-identifier">get_method</span>(<span class="ruby-identifier">klass</span>, <span class="ruby-identifier">singleton</span>, <span class="ruby-identifier">include_subclasses</span>, <span class="ruby-identifier">mid</span>) <span class="ruby-keyword">if</span> <span class="ruby-identifier">klass</span>
      <span class="ruby-keyword">if</span> <span class="ruby-identifier">meths</span>
        <span class="ruby-identifier">path</span>, <span class="ruby-identifier">loc</span> = <span class="ruby-constant">Config</span>.<span class="ruby-identifier">current</span>.<span class="ruby-identifier">options</span>[<span class="ruby-value">:signature_help_loc</span>]
        <span class="ruby-keyword">if</span> <span class="ruby-identifier">path</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">path</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">ep</span>.<span class="ruby-identifier">ctx</span>.<span class="ruby-identifier">iseq</span>.<span class="ruby-identifier">path</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">mid</span> <span class="ruby-operator">!=</span> <span class="ruby-value">:inherited</span> <span class="ruby-comment"># XXX: too ad-hoc!!!</span>
          <span class="ruby-identifier">path</span>, <span class="ruby-identifier">code_range</span> = <span class="ruby-identifier">ep</span>&amp;.<span class="ruby-identifier">detailed_source_location</span>
          <span class="ruby-keyword">if</span> <span class="ruby-identifier">path</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">code_range</span>&amp;.<span class="ruby-identifier">contain_loc?</span>(<span class="ruby-identifier">loc</span>)
            <span class="ruby-ivar">@lsp_signature_help</span>[<span class="ruby-identifier">code_range</span>] = {
              <span class="ruby-value">recv:</span> <span class="ruby-identifier">recv</span>,
              <span class="ruby-value">mid:</span> <span class="ruby-identifier">mid</span>,
              <span class="ruby-value">singleton:</span> <span class="ruby-identifier">singleton</span>,
              <span class="ruby-value">mdefs:</span> <span class="ruby-identifier">meths</span>,
              <span class="ruby-value">node_id:</span> <span class="ruby-identifier">aargs</span>.<span class="ruby-identifier">node_id</span>,
            }
          <span class="ruby-keyword">end</span>
        <span class="ruby-keyword">end</span>
        <span class="ruby-identifier">meths</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">meth</span><span class="ruby-operator">|</span>
          <span class="ruby-identifier">meth</span>.<span class="ruby-identifier">do_send</span>(<span class="ruby-identifier">recv</span>, <span class="ruby-identifier">mid</span>, <span class="ruby-identifier">aargs</span>, <span class="ruby-identifier">ep</span>, <span class="ruby-identifier">env</span>, <span class="ruby-keyword">self</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">ctn</span>)
        <span class="ruby-keyword">end</span>
      <span class="ruby-keyword">else</span>
        <span class="ruby-identifier">meths</span> = <span class="ruby-identifier">get_method</span>(<span class="ruby-identifier">klass</span>, <span class="ruby-identifier">singleton</span>, <span class="ruby-identifier">include_subclasses</span>, <span class="ruby-value">:method_missing</span>) <span class="ruby-keyword">if</span> <span class="ruby-identifier">klass</span>
        <span class="ruby-keyword">if</span> <span class="ruby-identifier">meths</span>
          <span class="ruby-identifier">aargs</span> = <span class="ruby-identifier">aargs</span>.<span class="ruby-identifier">for_method_missing</span>(<span class="ruby-constant">Type</span><span class="ruby-operator">::</span><span class="ruby-constant">Symbol</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">mid</span>, <span class="ruby-constant">Type</span><span class="ruby-operator">::</span><span class="ruby-constant">Instance</span>.<span class="ruby-identifier">new</span>(<span class="ruby-constant">Type</span><span class="ruby-operator">::</span><span class="ruby-constant">Builtin</span>[<span class="ruby-value">:sym</span>])))
          <span class="ruby-identifier">meths</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">meth</span><span class="ruby-operator">|</span>
            <span class="ruby-identifier">meth</span>.<span class="ruby-identifier">do_send</span>(<span class="ruby-identifier">recv</span>, <span class="ruby-value">:method_missing</span>, <span class="ruby-identifier">aargs</span>, <span class="ruby-identifier">ep</span>, <span class="ruby-identifier">env</span>, <span class="ruby-keyword">self</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">ctn</span>)
          <span class="ruby-keyword">end</span>
        <span class="ruby-keyword">else</span>
          <span class="ruby-identifier">error</span>(<span class="ruby-identifier">ep</span>, <span class="ruby-node">&quot;undefined method: #{ globalize_type(recv, env, ep).screen_name(self) }##{ mid }&quot;</span>)
          <span class="ruby-identifier">ctn</span>[<span class="ruby-constant">Type</span>.<span class="ruby-identifier">any</span>, <span class="ruby-identifier">ep</span>, <span class="ruby-identifier">env</span>]
        <span class="ruby-keyword">end</span>
      <span class="ruby-keyword">end</span>
    <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-error" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">error</span><span
                                class="method-args">(ep, msg)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="error-source">
            <pre><span class="ruby-comment"># File typeprof-0.21.8/lib/typeprof/analyzer.rb, line 954</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">error</span>(<span class="ruby-identifier">ep</span>, <span class="ruby-identifier">msg</span>)
  <span class="ruby-identifier">p</span> [<span class="ruby-identifier">ep</span>.<span class="ruby-identifier">source_location</span>, <span class="ruby-string">&quot;[error] &quot;</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">msg</span>] <span class="ruby-keyword">if</span> <span class="ruby-constant">Config</span>.<span class="ruby-identifier">current</span>.<span class="ruby-identifier">verbose</span> <span class="ruby-operator">&gt;=</span> <span class="ruby-value">2</span>
  <span class="ruby-ivar">@errors</span> <span class="ruby-operator">&lt;&lt;</span> [<span class="ruby-identifier">ep</span>, <span class="ruby-string">&quot;[error] &quot;</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">msg</span>]
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-get_all_methods" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">get_all_methods</span><span
                                class="method-args">(klass, singleton, _include_subclasses)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="get_all_methods-source">
            <pre><span class="ruby-comment"># File typeprof-0.21.8/lib/typeprof/analyzer.rb, line 661</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">get_all_methods</span>(<span class="ruby-identifier">klass</span>, <span class="ruby-identifier">singleton</span>, <span class="ruby-identifier">_include_subclasses</span>)
  <span class="ruby-identifier">names</span> = {}

  <span class="ruby-keyword">if</span> <span class="ruby-identifier">klass</span>.<span class="ruby-identifier">kind</span> <span class="ruby-operator">==</span> <span class="ruby-value">:class</span>
    <span class="ruby-keyword">while</span> <span class="ruby-identifier">klass</span> <span class="ruby-operator">!=</span> <span class="ruby-value">:__root__</span>
      <span class="ruby-comment"># TODO: module</span>
      <span class="ruby-ivar">@class_defs</span>[<span class="ruby-identifier">klass</span>.<span class="ruby-identifier">idx</span>].<span class="ruby-identifier">methods</span>.<span class="ruby-identifier">each_key</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">singleton0</span>, <span class="ruby-identifier">name</span><span class="ruby-operator">|</span>
        <span class="ruby-keyword">if</span> <span class="ruby-identifier">singleton</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">singleton0</span>
          <span class="ruby-identifier">names</span>[<span class="ruby-identifier">name</span>] = <span class="ruby-keyword">true</span>
        <span class="ruby-keyword">end</span>
      <span class="ruby-keyword">end</span>
      <span class="ruby-identifier">klass</span> = <span class="ruby-identifier">klass</span>.<span class="ruby-identifier">superclass</span>
    <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">else</span>
    <span class="ruby-ivar">@class_defs</span>[<span class="ruby-identifier">klass</span>.<span class="ruby-identifier">idx</span>].<span class="ruby-identifier">methods</span>.<span class="ruby-identifier">each_key</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">singleton0</span>, <span class="ruby-identifier">name</span><span class="ruby-operator">|</span>
      <span class="ruby-keyword">if</span> <span class="ruby-identifier">singleton</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">singleton0</span>
        <span class="ruby-identifier">names</span>[<span class="ruby-identifier">name</span>] = <span class="ruby-keyword">true</span>
      <span class="ruby-keyword">end</span>
    <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">end</span>

  <span class="ruby-identifier">names</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-get_all_super_methods" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">get_all_super_methods</span><span
                                class="method-args">(klass, singleton, current_klass, mid) { |mthds, klass0, singleton0| ... }</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="get_all_super_methods-source">
            <pre><span class="ruby-comment"># File typeprof-0.21.8/lib/typeprof/analyzer.rb, line 633</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">get_all_super_methods</span>(<span class="ruby-identifier">klass</span>, <span class="ruby-identifier">singleton</span>, <span class="ruby-identifier">current_klass</span>, <span class="ruby-identifier">mid</span>)
  <span class="ruby-identifier">hit</span> = <span class="ruby-keyword">false</span>
  <span class="ruby-identifier">search_method</span>(<span class="ruby-identifier">klass</span>, <span class="ruby-identifier">singleton</span>, <span class="ruby-identifier">mid</span>) <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">mthds</span>, <span class="ruby-identifier">klass0</span>, <span class="ruby-identifier">singleton0</span><span class="ruby-operator">|</span>
    <span class="ruby-keyword">yield</span> <span class="ruby-identifier">mthds</span>, <span class="ruby-identifier">klass0</span>, <span class="ruby-identifier">singleton0</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">hit</span>
    <span class="ruby-identifier">hit</span> = <span class="ruby-identifier">klass0</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">current_klass</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-get_array_elem_type" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">get_array_elem_type</span><span
                                class="method-args">(env, ep, id, idx = nil)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="get_array_elem_type-source">
            <pre><span class="ruby-comment"># File typeprof-0.21.8/lib/typeprof/analyzer.rb, line 1012</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">get_array_elem_type</span>(<span class="ruby-identifier">env</span>, <span class="ruby-identifier">ep</span>, <span class="ruby-identifier">id</span>, <span class="ruby-identifier">idx</span> = <span class="ruby-keyword">nil</span>)
  <span class="ruby-identifier">elems</span> = <span class="ruby-identifier">get_container_elem_types</span>(<span class="ruby-identifier">env</span>, <span class="ruby-identifier">ep</span>, <span class="ruby-identifier">id</span>)

  <span class="ruby-keyword">if</span> <span class="ruby-identifier">elems</span>
    <span class="ruby-keyword">return</span> <span class="ruby-identifier">elems</span>[<span class="ruby-identifier">idx</span>] <span class="ruby-operator">||</span> <span class="ruby-constant">Type</span>.<span class="ruby-identifier">nil</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">idx</span>
    <span class="ruby-keyword">return</span> <span class="ruby-identifier">elems</span>.<span class="ruby-identifier">squash_or_any</span>
  <span class="ruby-keyword">else</span>
    <span class="ruby-constant">Type</span>.<span class="ruby-identifier">any</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-get_class_name" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">get_class_name</span><span
                                class="method-args">(klass)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="get_class_name-source">
            <pre><span class="ruby-comment"># File typeprof-0.21.8/lib/typeprof/analyzer.rb, line 548</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">get_class_name</span>(<span class="ruby-identifier">klass</span>)
  <span class="ruby-keyword">if</span> <span class="ruby-identifier">klass</span> <span class="ruby-operator">==</span> <span class="ruby-constant">Type</span>.<span class="ruby-identifier">any</span>
    <span class="ruby-string">&quot;???&quot;</span>
  <span class="ruby-keyword">else</span>
    <span class="ruby-identifier">path</span> = <span class="ruby-ivar">@class_defs</span>[<span class="ruby-identifier">klass</span>.<span class="ruby-identifier">idx</span>].<span class="ruby-identifier">name</span>
    <span class="ruby-keyword">if</span> <span class="ruby-ivar">@namespace</span>
      <span class="ruby-identifier">i</span> = <span class="ruby-value">0</span>
      <span class="ruby-identifier">i</span> <span class="ruby-operator">+=</span> <span class="ruby-value">1</span> <span class="ruby-keyword">while</span> <span class="ruby-ivar">@namespace</span>[<span class="ruby-identifier">i</span>] <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-ivar">@namespace</span>[<span class="ruby-identifier">i</span>] <span class="ruby-operator">==</span> <span class="ruby-identifier">path</span>[<span class="ruby-identifier">i</span>]
      <span class="ruby-keyword">if</span> <span class="ruby-identifier">path</span>[<span class="ruby-identifier">i</span>]
        <span class="ruby-identifier">path</span>[<span class="ruby-identifier">i</span><span class="ruby-operator">..</span>].<span class="ruby-identifier">join</span>(<span class="ruby-string">&quot;::&quot;</span>)
      <span class="ruby-keyword">else</span>
        <span class="ruby-identifier">path</span>.<span class="ruby-identifier">last</span>.<span class="ruby-identifier">to_s</span>
      <span class="ruby-keyword">end</span>
    <span class="ruby-keyword">else</span>
      <span class="ruby-comment">#&quot;::&quot; + path.join(&quot;::&quot;)</span>
      <span class="ruby-identifier">path</span>.<span class="ruby-identifier">join</span>(<span class="ruby-string">&quot;::&quot;</span>)
    <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-get_constant" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">get_constant</span><span
                                class="method-args">(klass, name)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="get_constant-source">
            <pre><span class="ruby-comment"># File typeprof-0.21.8/lib/typeprof/analyzer.rb, line 685</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">get_constant</span>(<span class="ruby-identifier">klass</span>, <span class="ruby-identifier">name</span>)
  <span class="ruby-keyword">if</span> <span class="ruby-identifier">klass</span> <span class="ruby-operator">==</span> <span class="ruby-constant">Type</span>.<span class="ruby-identifier">any</span>
    [<span class="ruby-constant">Type</span>.<span class="ruby-identifier">any</span>, <span class="ruby-keyword">nil</span>]
  <span class="ruby-keyword">elsif</span> <span class="ruby-identifier">klass</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Type</span><span class="ruby-operator">::</span><span class="ruby-constant">Class</span>)
    <span class="ruby-ivar">@class_defs</span>[<span class="ruby-identifier">klass</span>.<span class="ruby-identifier">idx</span>].<span class="ruby-identifier">get_constant</span>(<span class="ruby-identifier">name</span>)
  <span class="ruby-keyword">else</span>
    [<span class="ruby-constant">Type</span>.<span class="ruby-identifier">any</span>, <span class="ruby-keyword">nil</span>]
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-get_container_elem_types" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">get_container_elem_types</span><span
                                class="method-args">(env, ep, id)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="get_container_elem_types-source">
            <pre><span class="ruby-comment"># File typeprof-0.21.8/lib/typeprof/analyzer.rb, line 974</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">get_container_elem_types</span>(<span class="ruby-identifier">env</span>, <span class="ruby-identifier">ep</span>, <span class="ruby-identifier">id</span>)
  <span class="ruby-keyword">if</span> <span class="ruby-identifier">ep</span>.<span class="ruby-identifier">outer</span>
    <span class="ruby-identifier">tmp_ep</span> = <span class="ruby-identifier">ep</span>
    <span class="ruby-identifier">tmp_ep</span> = <span class="ruby-identifier">tmp_ep</span>.<span class="ruby-identifier">outer</span> <span class="ruby-keyword">while</span> <span class="ruby-identifier">tmp_ep</span>.<span class="ruby-identifier">outer</span>
    <span class="ruby-identifier">env</span> = <span class="ruby-ivar">@return_envs</span>[<span class="ruby-identifier">tmp_ep</span>]
  <span class="ruby-keyword">end</span>
  <span class="ruby-identifier">env</span>.<span class="ruby-identifier">get_container_elem_types</span>(<span class="ruby-identifier">id</span>)
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-get_env" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">get_env</span><span
                                class="method-args">(ep)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="get_env-source">
            <pre><span class="ruby-comment"># File typeprof-0.21.8/lib/typeprof/analyzer.rb, line 325</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">get_env</span>(<span class="ruby-identifier">ep</span>)
  <span class="ruby-ivar">@ep2env</span>[<span class="ruby-identifier">ep</span>]
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-get_hash_elem_type" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">get_hash_elem_type</span><span
                                class="method-args">(env, ep, id, key_ty = nil)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="get_hash_elem_type-source">
            <pre><span class="ruby-comment"># File typeprof-0.21.8/lib/typeprof/analyzer.rb, line 1023</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">get_hash_elem_type</span>(<span class="ruby-identifier">env</span>, <span class="ruby-identifier">ep</span>, <span class="ruby-identifier">id</span>, <span class="ruby-identifier">key_ty</span> = <span class="ruby-keyword">nil</span>)
  <span class="ruby-identifier">elems</span> = <span class="ruby-identifier">get_container_elem_types</span>(<span class="ruby-identifier">env</span>, <span class="ruby-identifier">ep</span>, <span class="ruby-identifier">id</span>)

  <span class="ruby-keyword">if</span> <span class="ruby-identifier">elems</span>
    <span class="ruby-identifier">elems</span>[<span class="ruby-identifier">globalize_type</span>(<span class="ruby-identifier">key_ty</span>, <span class="ruby-identifier">env</span>, <span class="ruby-identifier">ep</span>) <span class="ruby-operator">||</span> <span class="ruby-constant">Type</span>.<span class="ruby-identifier">any</span>]
  <span class="ruby-keyword">else</span>
    <span class="ruby-constant">Type</span>.<span class="ruby-identifier">any</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-get_instance_variable" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">get_instance_variable</span><span
                                class="method-args">(recv, var, ep, env) { |ty, nenv| ... }</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="get_instance_variable-source">
            <pre><span class="ruby-comment"># File typeprof-0.21.8/lib/typeprof/analyzer.rb, line 1265</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">get_instance_variable</span>(<span class="ruby-identifier">recv</span>, <span class="ruby-identifier">var</span>, <span class="ruby-identifier">ep</span>, <span class="ruby-identifier">env</span>)
  <span class="ruby-identifier">add_ivar_read!</span>(<span class="ruby-identifier">recv</span>, <span class="ruby-identifier">var</span>, <span class="ruby-identifier">ep</span>) <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">ty</span>, <span class="ruby-identifier">ep</span>, <span class="ruby-identifier">write_eps</span><span class="ruby-operator">|</span>
    <span class="ruby-identifier">alloc_site</span> = <span class="ruby-constant">AllocationSite</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">ep</span>)
    <span class="ruby-identifier">nenv</span>, <span class="ruby-identifier">ty</span> = <span class="ruby-identifier">localize_type</span>(<span class="ruby-identifier">ty</span>, <span class="ruby-identifier">env</span>, <span class="ruby-identifier">ep</span>, <span class="ruby-identifier">alloc_site</span>)
    <span class="ruby-keyword">case</span> <span class="ruby-identifier">ty</span>
    <span class="ruby-keyword">when</span> <span class="ruby-constant">Type</span><span class="ruby-operator">::</span><span class="ruby-constant">Local</span>
      <span class="ruby-ivar">@alloc_site_to_global_id</span>[<span class="ruby-identifier">ty</span>.<span class="ruby-identifier">id</span>] = [<span class="ruby-identifier">recv</span>, <span class="ruby-identifier">var</span>] <span class="ruby-comment"># need overwrite check??</span>
    <span class="ruby-keyword">end</span>
    <span class="ruby-identifier">write_eps</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">write_ep</span><span class="ruby-operator">|</span>
      <span class="ruby-identifier">ep</span>.<span class="ruby-identifier">ctx</span>.<span class="ruby-identifier">iseq</span>.<span class="ruby-identifier">add_def_loc</span>(<span class="ruby-identifier">ep</span>.<span class="ruby-identifier">pc</span>, <span class="ruby-identifier">write_ep</span>.<span class="ruby-identifier">detailed_source_location</span>)
    <span class="ruby-keyword">end</span>
    <span class="ruby-keyword">yield</span> <span class="ruby-identifier">ty</span>, <span class="ruby-identifier">nenv</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-get_ivar" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">get_ivar</span><span
                                class="method-args">(recv, var)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="get_ivar-source">
            <pre><span class="ruby-comment"># File typeprof-0.21.8/lib/typeprof/analyzer.rb, line 899</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">get_ivar</span>(<span class="ruby-identifier">recv</span>, <span class="ruby-identifier">var</span>)
  <span class="ruby-identifier">recv</span> = <span class="ruby-identifier">recv</span>.<span class="ruby-identifier">base_type</span> <span class="ruby-keyword">while</span> <span class="ruby-identifier">recv</span>.<span class="ruby-identifier">respond_to?</span>(<span class="ruby-value">:base_type</span>)

  <span class="ruby-identifier">klass</span>, <span class="ruby-identifier">singleton</span> = <span class="ruby-identifier">identify_class_for_ivar</span>(<span class="ruby-identifier">recv</span>, <span class="ruby-identifier">var</span>.<span class="ruby-identifier">to_s</span>[<span class="ruby-value">1</span><span class="ruby-operator">..</span>].<span class="ruby-identifier">to_sym</span>) <span class="ruby-comment"># search attr_reader</span>

  <span class="ruby-keyword">if</span> <span class="ruby-identifier">klass</span>
    <span class="ruby-keyword">return</span> <span class="ruby-ivar">@class_defs</span>[<span class="ruby-identifier">klass</span>.<span class="ruby-identifier">idx</span>], <span class="ruby-identifier">singleton</span>
  <span class="ruby-keyword">else</span>
    <span class="ruby-keyword">return</span> <span class="ruby-keyword">nil</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-get_method" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">get_method</span><span
                                class="method-args">(klass, singleton, include_subclasses, mid)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="get_method-source">
            <pre><span class="ruby-comment"># File typeprof-0.21.8/lib/typeprof/analyzer.rb, line 618</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">get_method</span>(<span class="ruby-identifier">klass</span>, <span class="ruby-identifier">singleton</span>, <span class="ruby-identifier">include_subclasses</span>, <span class="ruby-identifier">mid</span>)
  <span class="ruby-keyword">if</span> <span class="ruby-identifier">include_subclasses</span>
    <span class="ruby-identifier">subclasses_mthds</span> = []
    <span class="ruby-identifier">traverse_subclasses</span>(<span class="ruby-identifier">klass</span>) <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">subclass</span><span class="ruby-operator">|</span>
      <span class="ruby-identifier">subclass</span>.<span class="ruby-identifier">search_method</span>(<span class="ruby-identifier">singleton</span>, <span class="ruby-identifier">mid</span>, {}) <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">mthds</span>,<span class="ruby-operator">|</span>
        <span class="ruby-identifier">subclasses_mthds</span>.<span class="ruby-identifier">concat</span>(<span class="ruby-identifier">mthds</span>.<span class="ruby-identifier">to_a</span>)
      <span class="ruby-keyword">end</span>
    <span class="ruby-keyword">end</span>
    <span class="ruby-identifier">search_method</span>(<span class="ruby-identifier">klass</span>, <span class="ruby-identifier">singleton</span>, <span class="ruby-identifier">mid</span>) {<span class="ruby-operator">|</span><span class="ruby-identifier">mthds</span>,<span class="ruby-operator">|</span> <span class="ruby-keyword">return</span> <span class="ruby-identifier">subclasses_mthds</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">mthds</span>.<span class="ruby-identifier">to_a</span> }
    <span class="ruby-keyword">return</span> <span class="ruby-identifier">subclasses_mthds</span>
  <span class="ruby-keyword">end</span>

  <span class="ruby-identifier">search_method</span>(<span class="ruby-identifier">klass</span>, <span class="ruby-identifier">singleton</span>, <span class="ruby-identifier">mid</span>) {<span class="ruby-operator">|</span><span class="ruby-identifier">mthds</span>,<span class="ruby-operator">|</span> <span class="ruby-keyword">return</span> <span class="ruby-identifier">mthds</span> }
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-get_super_method" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">get_super_method</span><span
                                class="method-args">(ctx, singleton)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="get_super_method-source">
            <pre><span class="ruby-comment"># File typeprof-0.21.8/lib/typeprof/analyzer.rb, line 641</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">get_super_method</span>(<span class="ruby-identifier">ctx</span>, <span class="ruby-identifier">singleton</span>)
  <span class="ruby-identifier">klass</span> = <span class="ruby-identifier">ctx</span>.<span class="ruby-identifier">cref</span>.<span class="ruby-identifier">klass</span>
  <span class="ruby-identifier">mid</span> = <span class="ruby-identifier">ctx</span>.<span class="ruby-identifier">mid</span>
  <span class="ruby-keyword">if</span> <span class="ruby-identifier">klass</span>.<span class="ruby-identifier">kind</span> <span class="ruby-operator">==</span> <span class="ruby-value">:class</span>
    <span class="ruby-identifier">klass</span> = <span class="ruby-identifier">klass</span>.<span class="ruby-identifier">superclass</span>
    <span class="ruby-keyword">while</span> <span class="ruby-identifier">klass</span> <span class="ruby-operator">!=</span> <span class="ruby-value">:__root__</span>
      <span class="ruby-identifier">class_def</span> = <span class="ruby-ivar">@class_defs</span>[<span class="ruby-identifier">klass</span>.<span class="ruby-identifier">idx</span>]
      <span class="ruby-identifier">mthd</span> = <span class="ruby-identifier">class_def</span>.<span class="ruby-identifier">get_method</span>(<span class="ruby-identifier">mid</span>, <span class="ruby-identifier">singleton</span>)
      <span class="ruby-keyword">return</span> <span class="ruby-identifier">mthd</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">mthd</span>
      <span class="ruby-identifier">klass</span> = <span class="ruby-identifier">klass</span>.<span class="ruby-identifier">superclass</span>
    <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">else</span>
    <span class="ruby-comment"># module</span>
    <span class="ruby-identifier">class_def</span> = <span class="ruby-ivar">@class_defs</span>[<span class="ruby-identifier">klass</span>.<span class="ruby-identifier">idx</span>]
    <span class="ruby-identifier">mthd</span> = <span class="ruby-identifier">class_def</span>.<span class="ruby-identifier">get_method</span>(<span class="ruby-identifier">mid</span>, <span class="ruby-identifier">singleton</span>)
    <span class="ruby-keyword">return</span> <span class="ruby-identifier">mthd</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">mthd</span>
  <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">nil</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-globalize_type" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">globalize_type</span><span
                                class="method-args">(ty, env, ep)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="globalize_type-source">
            <pre><span class="ruby-comment"># File typeprof-0.21.8/lib/typeprof/analyzer.rb, line 1184</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">globalize_type</span>(<span class="ruby-identifier">ty</span>, <span class="ruby-identifier">env</span>, <span class="ruby-identifier">ep</span>)
  <span class="ruby-keyword">if</span> <span class="ruby-identifier">ep</span>.<span class="ruby-identifier">outer</span>
    <span class="ruby-identifier">tmp_ep</span> = <span class="ruby-identifier">ep</span>
    <span class="ruby-identifier">tmp_ep</span> = <span class="ruby-identifier">tmp_ep</span>.<span class="ruby-identifier">outer</span> <span class="ruby-keyword">while</span> <span class="ruby-identifier">tmp_ep</span>.<span class="ruby-identifier">outer</span>
    <span class="ruby-identifier">env</span> = <span class="ruby-ivar">@return_envs</span>[<span class="ruby-identifier">tmp_ep</span>]
  <span class="ruby-keyword">end</span>
  <span class="ruby-identifier">ty</span>.<span class="ruby-identifier">globalize</span>(<span class="ruby-identifier">env</span>, {}, <span class="ruby-constant">Config</span>.<span class="ruby-identifier">current</span>.<span class="ruby-identifier">options</span>[<span class="ruby-value">:type_depth_limit</span>])
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-identify_class_for_ivar" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">identify_class_for_ivar</span><span
                                class="method-args">(recv, var)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="identify_class_for_ivar-source">
            <pre><span class="ruby-comment"># File typeprof-0.21.8/lib/typeprof/analyzer.rb, line 888</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">identify_class_for_ivar</span>(<span class="ruby-identifier">recv</span>, <span class="ruby-identifier">var</span>)
  <span class="ruby-identifier">klass</span>, <span class="ruby-identifier">singleton</span> = <span class="ruby-identifier">recv</span>.<span class="ruby-identifier">method_dispatch_info</span>
  <span class="ruby-keyword">return</span> <span class="ruby-keyword">nil</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">klass</span>
  <span class="ruby-identifier">search_method</span>(<span class="ruby-identifier">klass</span>, <span class="ruby-identifier">singleton</span>, <span class="ruby-identifier">var</span>) <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">mthds</span>, <span class="ruby-identifier">klass0</span>, <span class="ruby-identifier">singleton0</span><span class="ruby-operator">|</span>
    <span class="ruby-keyword">if</span> <span class="ruby-identifier">mthds</span>.<span class="ruby-identifier">any?</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">mthd</span><span class="ruby-operator">|</span> <span class="ruby-identifier">mthd</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">AttrMethodDef</span>) }
      <span class="ruby-keyword">return</span> <span class="ruby-identifier">klass0</span>, <span class="ruby-identifier">singleton</span>
    <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">return</span> <span class="ruby-identifier">klass</span>, <span class="ruby-identifier">singleton</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-inspect" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">inspect</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="inspect-source">
            <pre><span class="ruby-comment"># File typeprof-0.21.8/lib/typeprof/analyzer.rb, line 272</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">inspect</span>
  <span class="ruby-string">&quot;#&lt;Scratch&gt;&quot;</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-localize_type" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">localize_type</span><span
                                class="method-args">(ty, env, ep, alloc_site = AllocationSite.new(ep))</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="localize_type-source">
            <pre><span class="ruby-comment"># File typeprof-0.21.8/lib/typeprof/analyzer.rb, line 1193</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">localize_type</span>(<span class="ruby-identifier">ty</span>, <span class="ruby-identifier">env</span>, <span class="ruby-identifier">ep</span>, <span class="ruby-identifier">alloc_site</span> = <span class="ruby-constant">AllocationSite</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">ep</span>))
  <span class="ruby-keyword">if</span> <span class="ruby-identifier">ep</span>.<span class="ruby-identifier">outer</span>
    <span class="ruby-identifier">tmp_ep</span> = <span class="ruby-identifier">ep</span>
    <span class="ruby-identifier">tmp_ep</span> = <span class="ruby-identifier">tmp_ep</span>.<span class="ruby-identifier">outer</span> <span class="ruby-keyword">while</span> <span class="ruby-identifier">tmp_ep</span>.<span class="ruby-identifier">outer</span>
    <span class="ruby-identifier">target_env</span> = <span class="ruby-ivar">@return_envs</span>[<span class="ruby-identifier">tmp_ep</span>]
    <span class="ruby-identifier">target_env</span>, <span class="ruby-identifier">ty</span> = <span class="ruby-identifier">ty</span>.<span class="ruby-identifier">localize</span>(<span class="ruby-identifier">target_env</span>, <span class="ruby-identifier">alloc_site</span>, <span class="ruby-constant">Config</span>.<span class="ruby-identifier">current</span>.<span class="ruby-identifier">options</span>[<span class="ruby-value">:type_depth_limit</span>])
    <span class="ruby-identifier">merge_return_env</span>(<span class="ruby-identifier">tmp_ep</span>) <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">env</span><span class="ruby-operator">|</span>
      <span class="ruby-identifier">env</span> <span class="ruby-operator">?</span> <span class="ruby-identifier">env</span>.<span class="ruby-identifier">merge</span>(<span class="ruby-identifier">target_env</span>) <span class="ruby-operator">:</span> <span class="ruby-identifier">target_env</span>
    <span class="ruby-keyword">end</span>
    <span class="ruby-keyword">return</span> <span class="ruby-identifier">env</span>, <span class="ruby-identifier">ty</span>
  <span class="ruby-keyword">else</span>
    <span class="ruby-keyword">return</span> <span class="ruby-identifier">ty</span>.<span class="ruby-identifier">localize</span>(<span class="ruby-identifier">env</span>, <span class="ruby-identifier">alloc_site</span>, <span class="ruby-constant">Config</span>.<span class="ruby-identifier">current</span>.<span class="ruby-identifier">options</span>[<span class="ruby-value">:type_depth_limit</span>])
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-merge_env" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">merge_env</span><span
                                class="method-args">(ep, env)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="merge_env-source">
            <pre><span class="ruby-comment"># File typeprof-0.21.8/lib/typeprof/analyzer.rb, line 329</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">merge_env</span>(<span class="ruby-identifier">ep</span>, <span class="ruby-identifier">env</span>)
  <span class="ruby-comment"># TODO: this is wrong; it include not only proceeds but also indirect propagation like out-of-block variable modification</span>
  <span class="ruby-comment">#add_edge(ep, @ep)</span>
  <span class="ruby-identifier">env2</span> = <span class="ruby-ivar">@ep2env</span>[<span class="ruby-identifier">ep</span>]
  <span class="ruby-keyword">if</span> <span class="ruby-identifier">env2</span>
    <span class="ruby-identifier">nenv</span> = <span class="ruby-identifier">env2</span>.<span class="ruby-identifier">merge</span>(<span class="ruby-identifier">env</span>)
    <span class="ruby-keyword">if</span> <span class="ruby-identifier">nenv</span> <span class="ruby-operator">!=</span> <span class="ruby-identifier">env2</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-operator">!</span><span class="ruby-ivar">@worklist</span>.<span class="ruby-identifier">member?</span>(<span class="ruby-identifier">ep</span>)
      <span class="ruby-ivar">@worklist</span>.<span class="ruby-identifier">insert</span>(<span class="ruby-identifier">ep</span>.<span class="ruby-identifier">key</span>, <span class="ruby-identifier">ep</span>)
    <span class="ruby-keyword">end</span>
    <span class="ruby-ivar">@ep2env</span>[<span class="ruby-identifier">ep</span>] = <span class="ruby-identifier">nenv</span>
  <span class="ruby-keyword">else</span>
    <span class="ruby-ivar">@worklist</span>.<span class="ruby-identifier">insert</span>(<span class="ruby-identifier">ep</span>.<span class="ruby-identifier">key</span>, <span class="ruby-identifier">ep</span>)
    <span class="ruby-ivar">@ep2env</span>[<span class="ruby-identifier">ep</span>] = <span class="ruby-identifier">env</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-merge_return_env" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">merge_return_env</span><span
                                class="method-args">(caller_ep) { |return_envs| ... }</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="merge_return_env-source">
            <pre><span class="ruby-comment"># File typeprof-0.21.8/lib/typeprof/analyzer.rb, line 821</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">merge_return_env</span>(<span class="ruby-identifier">caller_ep</span>)
  <span class="ruby-ivar">@return_envs</span>[<span class="ruby-identifier">caller_ep</span>] = <span class="ruby-keyword">yield</span> <span class="ruby-ivar">@return_envs</span>[<span class="ruby-identifier">caller_ep</span>]
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-mix_module" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">mix_module</span><span
                                class="method-args">(kind, mixing_mod, mixed_mod, type_args, singleton, caller_ep)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="mix_module-source">
            <pre><span class="ruby-comment"># File typeprof-0.21.8/lib/typeprof/analyzer.rb, line 482</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">mix_module</span>(<span class="ruby-identifier">kind</span>, <span class="ruby-identifier">mixing_mod</span>, <span class="ruby-identifier">mixed_mod</span>, <span class="ruby-identifier">type_args</span>, <span class="ruby-identifier">singleton</span>, <span class="ruby-identifier">caller_ep</span>)
  <span class="ruby-keyword">return</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">mixed_mod</span> <span class="ruby-operator">==</span> <span class="ruby-constant">Type</span>.<span class="ruby-identifier">any</span>

  <span class="ruby-identifier">mixing_mod</span> = <span class="ruby-ivar">@class_defs</span>[<span class="ruby-identifier">mixing_mod</span>.<span class="ruby-identifier">idx</span>]
  <span class="ruby-identifier">mixed_mod</span>.<span class="ruby-identifier">each_child</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">mixed_mod</span><span class="ruby-operator">|</span>
    <span class="ruby-keyword">if</span> <span class="ruby-identifier">mixed_mod</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Type</span><span class="ruby-operator">::</span><span class="ruby-constant">Class</span>)
      <span class="ruby-identifier">mixed_mod</span> = <span class="ruby-ivar">@class_defs</span>[<span class="ruby-identifier">mixed_mod</span>.<span class="ruby-identifier">idx</span>]
      <span class="ruby-keyword">if</span> <span class="ruby-identifier">mixed_mod</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">mixed_mod</span>.<span class="ruby-identifier">kind</span> <span class="ruby-operator">==</span> <span class="ruby-value">:module</span>
        <span class="ruby-identifier">mixing_mod</span>.<span class="ruby-identifier">mix_module</span>(<span class="ruby-identifier">kind</span>, <span class="ruby-identifier">mixed_mod</span>, <span class="ruby-identifier">type_args</span>, <span class="ruby-identifier">singleton</span>, <span class="ruby-identifier">caller_ep</span> <span class="ruby-operator">?</span> <span class="ruby-identifier">caller_ep</span>.<span class="ruby-identifier">ctx</span>.<span class="ruby-identifier">iseq</span>.<span class="ruby-identifier">absolute_path</span> <span class="ruby-operator">:</span> <span class="ruby-keyword">nil</span>)
      <span class="ruby-keyword">else</span>
        <span class="ruby-identifier">warn</span>(<span class="ruby-identifier">caller_ep</span>, <span class="ruby-node">&quot;attempted to #{ kind == :after ? &quot;include/extend&quot; : &quot;prepend&quot; } non-module; ignored&quot;</span>)
      <span class="ruby-keyword">end</span>
    <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-new_class" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">new_class</span><span
                                class="method-args">(cbase, name, type_params, superclass, def_ep)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="new_class-source">
            <pre><span class="ruby-comment"># File typeprof-0.21.8/lib/typeprof/analyzer.rb, line 502</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">new_class</span>(<span class="ruby-identifier">cbase</span>, <span class="ruby-identifier">name</span>, <span class="ruby-identifier">type_params</span>, <span class="ruby-identifier">superclass</span>, <span class="ruby-identifier">def_ep</span>)
  <span class="ruby-identifier">show_name</span> = <span class="ruby-identifier">cbase_path</span>(<span class="ruby-identifier">cbase</span>) <span class="ruby-operator">+</span> [<span class="ruby-identifier">name</span>]
  <span class="ruby-identifier">idx</span> = <span class="ruby-ivar">@class_defs</span>.<span class="ruby-identifier">size</span>
  <span class="ruby-keyword">if</span> <span class="ruby-identifier">superclass</span>
    <span class="ruby-identifier">superclass_def</span> = <span class="ruby-ivar">@class_defs</span>[<span class="ruby-identifier">superclass</span>.<span class="ruby-identifier">idx</span>] <span class="ruby-keyword">unless</span> <span class="ruby-identifier">superclass</span> <span class="ruby-operator">==</span> <span class="ruby-value">:__root__</span>
    <span class="ruby-ivar">@class_defs</span>[<span class="ruby-identifier">idx</span>] = <span class="ruby-constant">ClassDef</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">:class</span>, <span class="ruby-identifier">show_name</span>, <span class="ruby-identifier">def_ep</span>&amp;.<span class="ruby-identifier">absolute_path</span>, <span class="ruby-identifier">superclass_def</span>)
    <span class="ruby-identifier">superclass_def</span>.<span class="ruby-identifier">subclasses</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">idx</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">superclass_def</span>
    <span class="ruby-identifier">klass</span> = <span class="ruby-constant">Type</span><span class="ruby-operator">::</span><span class="ruby-constant">Class</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">:class</span>, <span class="ruby-identifier">idx</span>, <span class="ruby-identifier">type_params</span>, <span class="ruby-identifier">superclass</span>, <span class="ruby-identifier">show_name</span>)
    <span class="ruby-ivar">@class_defs</span>[<span class="ruby-identifier">idx</span>].<span class="ruby-identifier">klass_obj</span> = <span class="ruby-identifier">klass</span>
    <span class="ruby-identifier">cbase</span> <span class="ruby-operator">||=</span> <span class="ruby-identifier">klass</span> <span class="ruby-comment"># for bootstrap</span>
    <span class="ruby-identifier">add_constant</span>(<span class="ruby-identifier">cbase</span>, <span class="ruby-identifier">name</span>, <span class="ruby-identifier">klass</span>, <span class="ruby-identifier">def_ep</span>)
    <span class="ruby-keyword">return</span> <span class="ruby-identifier">klass</span>
  <span class="ruby-keyword">else</span>
    <span class="ruby-comment"># module</span>
    <span class="ruby-ivar">@class_defs</span>[<span class="ruby-identifier">idx</span>] = <span class="ruby-constant">ClassDef</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">:module</span>, <span class="ruby-identifier">show_name</span>, <span class="ruby-identifier">def_ep</span>&amp;.<span class="ruby-identifier">absolute_path</span>, <span class="ruby-keyword">nil</span>)
    <span class="ruby-identifier">mod</span> = <span class="ruby-constant">Type</span><span class="ruby-operator">::</span><span class="ruby-constant">Class</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">:module</span>, <span class="ruby-identifier">idx</span>, <span class="ruby-identifier">type_params</span>, <span class="ruby-keyword">nil</span>, <span class="ruby-identifier">show_name</span>)
    <span class="ruby-ivar">@class_defs</span>[<span class="ruby-identifier">idx</span>].<span class="ruby-identifier">klass_obj</span> = <span class="ruby-identifier">mod</span>
    <span class="ruby-identifier">add_constant</span>(<span class="ruby-identifier">cbase</span>, <span class="ruby-identifier">name</span>, <span class="ruby-identifier">mod</span>, <span class="ruby-identifier">def_ep</span>)
    <span class="ruby-keyword">return</span> <span class="ruby-identifier">mod</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-new_struct" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">new_struct</span><span
                                class="method-args">(ep)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="new_struct-source">
            <pre><span class="ruby-comment"># File typeprof-0.21.8/lib/typeprof/analyzer.rb, line 528</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">new_struct</span>(<span class="ruby-identifier">ep</span>)
  <span class="ruby-keyword">return</span> <span class="ruby-ivar">@struct_defs</span>[<span class="ruby-identifier">ep</span>] <span class="ruby-keyword">if</span> <span class="ruby-ivar">@struct_defs</span>[<span class="ruby-identifier">ep</span>]

  <span class="ruby-identifier">idx</span> = <span class="ruby-ivar">@class_defs</span>.<span class="ruby-identifier">size</span>
  <span class="ruby-identifier">superclass</span> = <span class="ruby-constant">Type</span><span class="ruby-operator">::</span><span class="ruby-constant">Builtin</span>[<span class="ruby-value">:struct</span>]
  <span class="ruby-identifier">name</span> = <span class="ruby-node">&quot;AnonymousStruct_generated_#{ @anonymous_struct_gen_id += 1 }&quot;</span>
  <span class="ruby-comment"># Should we pass a superclass here?</span>
  <span class="ruby-ivar">@class_defs</span>[<span class="ruby-identifier">idx</span>] = <span class="ruby-constant">ClassDef</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">:class</span>, [<span class="ruby-identifier">name</span>], <span class="ruby-identifier">ep</span>.<span class="ruby-identifier">ctx</span>.<span class="ruby-identifier">iseq</span>.<span class="ruby-identifier">absolute_path</span>, <span class="ruby-keyword">nil</span>)
  <span class="ruby-comment">#@class_defs[superclass.idx].subclasses &lt;&lt; idx # needed?</span>
  <span class="ruby-identifier">klass</span> = <span class="ruby-constant">Type</span><span class="ruby-operator">::</span><span class="ruby-constant">Class</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">:class</span>, <span class="ruby-identifier">idx</span>, [], <span class="ruby-identifier">superclass</span>, <span class="ruby-identifier">name</span>)
  <span class="ruby-identifier">add_superclass_type_args!</span>(<span class="ruby-identifier">klass</span>, [<span class="ruby-constant">Type</span>.<span class="ruby-identifier">any</span>])
  <span class="ruby-ivar">@class_defs</span>[<span class="ruby-identifier">idx</span>].<span class="ruby-identifier">klass_obj</span> = <span class="ruby-identifier">klass</span>

  <span class="ruby-ivar">@struct_defs</span>[<span class="ruby-identifier">ep</span>] = <span class="ruby-identifier">klass</span>

  <span class="ruby-identifier">klass</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-pend_block_dummy_execution" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">pend_block_dummy_execution</span><span
                                class="method-args">(blk, iseq, nep, nenv)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="pend_block_dummy_execution-source">
            <pre><span class="ruby-comment"># File typeprof-0.21.8/lib/typeprof/analyzer.rb, line 1252</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">pend_block_dummy_execution</span>(<span class="ruby-identifier">blk</span>, <span class="ruby-identifier">iseq</span>, <span class="ruby-identifier">nep</span>, <span class="ruby-identifier">nenv</span>)
  <span class="ruby-ivar">@pending_execution</span>[<span class="ruby-identifier">iseq</span>] <span class="ruby-operator">||=</span> [<span class="ruby-value">:block</span>, [<span class="ruby-identifier">blk</span>, {}]]
  <span class="ruby-keyword">if</span> <span class="ruby-ivar">@pending_execution</span>[<span class="ruby-identifier">iseq</span>][<span class="ruby-value">0</span>] <span class="ruby-operator">==</span> <span class="ruby-value">:block</span>
    <span class="ruby-keyword">if</span> <span class="ruby-ivar">@pending_execution</span>[<span class="ruby-identifier">iseq</span>][<span class="ruby-value">1</span>][<span class="ruby-value">1</span>][<span class="ruby-identifier">nep</span>]
      <span class="ruby-ivar">@pending_execution</span>[<span class="ruby-identifier">iseq</span>][<span class="ruby-value">1</span>][<span class="ruby-value">1</span>][<span class="ruby-identifier">nep</span>] = <span class="ruby-ivar">@pending_execution</span>[<span class="ruby-identifier">iseq</span>][<span class="ruby-value">1</span>][<span class="ruby-value">1</span>][<span class="ruby-identifier">nep</span>].<span class="ruby-identifier">merge</span>(<span class="ruby-identifier">nenv</span>)
    <span class="ruby-keyword">else</span>
      <span class="ruby-ivar">@pending_execution</span>[<span class="ruby-identifier">iseq</span>][<span class="ruby-value">1</span>][<span class="ruby-value">1</span>][<span class="ruby-identifier">nep</span>] = <span class="ruby-identifier">nenv</span>
    <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">else</span>
    <span class="ruby-comment"># XXX: what to do?</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-pend_method_execution" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">pend_method_execution</span><span
                                class="method-args">(iseq, meth, recv, mid, cref, ep)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="pend_method_execution-source">
            <pre><span class="ruby-comment"># File typeprof-0.21.8/lib/typeprof/analyzer.rb, line 1208</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">pend_method_execution</span>(<span class="ruby-identifier">iseq</span>, <span class="ruby-identifier">meth</span>, <span class="ruby-identifier">recv</span>, <span class="ruby-identifier">mid</span>, <span class="ruby-identifier">cref</span>, <span class="ruby-identifier">ep</span>)
  <span class="ruby-identifier">ctx</span> = <span class="ruby-constant">Context</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">iseq</span>, <span class="ruby-identifier">cref</span>, <span class="ruby-identifier">mid</span>)
  <span class="ruby-identifier">ep</span> = <span class="ruby-constant">ExecutionPoint</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">ctx</span>, <span class="ruby-value">0</span>, <span class="ruby-identifier">ep</span>)
  <span class="ruby-identifier">locals</span> = [<span class="ruby-constant">Type</span>.<span class="ruby-identifier">nil</span>] <span class="ruby-operator">*</span> <span class="ruby-identifier">iseq</span>.<span class="ruby-identifier">locals</span>.<span class="ruby-identifier">size</span>

  <span class="ruby-identifier">fargs_format</span> = <span class="ruby-identifier">iseq</span>.<span class="ruby-identifier">fargs_format</span>
  <span class="ruby-identifier">lead_num</span> = <span class="ruby-identifier">fargs_format</span>[<span class="ruby-value">:lead_num</span>] <span class="ruby-operator">||</span> <span class="ruby-value">0</span>
  <span class="ruby-identifier">post_num</span> = <span class="ruby-identifier">fargs_format</span>[<span class="ruby-value">:post_num</span>] <span class="ruby-operator">||</span> <span class="ruby-value">0</span>
  <span class="ruby-identifier">post_index</span> = <span class="ruby-identifier">fargs_format</span>[<span class="ruby-value">:post_start</span>]
  <span class="ruby-identifier">rest_index</span> = <span class="ruby-identifier">fargs_format</span>[<span class="ruby-value">:rest_start</span>]
  <span class="ruby-identifier">keyword</span> = <span class="ruby-identifier">fargs_format</span>[<span class="ruby-value">:keyword</span>]
  <span class="ruby-identifier">kw_index</span> = <span class="ruby-identifier">fargs_format</span>[<span class="ruby-value">:kwbits</span>] <span class="ruby-operator">-</span> <span class="ruby-identifier">keyword</span>.<span class="ruby-identifier">size</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">keyword</span>
  <span class="ruby-identifier">kwrest_index</span> = <span class="ruby-identifier">fargs_format</span>[<span class="ruby-value">:kwrest</span>]
  <span class="ruby-identifier">block_index</span> = <span class="ruby-identifier">fargs_format</span>[<span class="ruby-value">:block_start</span>]
  <span class="ruby-identifier">opt</span> = <span class="ruby-identifier">fargs_format</span>[<span class="ruby-value">:opt</span>] <span class="ruby-operator">||</span> [<span class="ruby-value">0</span>]

  (<span class="ruby-identifier">lead_num</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">opt</span>.<span class="ruby-identifier">size</span> <span class="ruby-operator">-</span> <span class="ruby-value">1</span>).<span class="ruby-identifier">times</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">i</span><span class="ruby-operator">|</span> <span class="ruby-identifier">locals</span>[<span class="ruby-identifier">i</span>] = <span class="ruby-constant">Type</span>.<span class="ruby-identifier">any</span> }
  <span class="ruby-identifier">post_num</span>.<span class="ruby-identifier">times</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">i</span><span class="ruby-operator">|</span> <span class="ruby-identifier">locals</span>[<span class="ruby-identifier">i</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">post_index</span>] = <span class="ruby-constant">Type</span>.<span class="ruby-identifier">any</span> } <span class="ruby-keyword">if</span> <span class="ruby-identifier">post_index</span>
  <span class="ruby-identifier">locals</span>[<span class="ruby-identifier">rest_index</span>] = <span class="ruby-constant">Type</span>.<span class="ruby-identifier">any</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">rest_index</span>
  <span class="ruby-keyword">if</span> <span class="ruby-identifier">keyword</span>
    <span class="ruby-identifier">keyword</span>.<span class="ruby-identifier">each_with_index</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">kw</span>, <span class="ruby-identifier">i</span><span class="ruby-operator">|</span>
      <span class="ruby-keyword">case</span>
      <span class="ruby-keyword">when</span> <span class="ruby-identifier">kw</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Symbol</span>) <span class="ruby-comment"># required keyword</span>
        <span class="ruby-identifier">locals</span>[<span class="ruby-identifier">kw_index</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">i</span>] = <span class="ruby-constant">Type</span>.<span class="ruby-identifier">any</span>
      <span class="ruby-keyword">when</span> <span class="ruby-identifier">kw</span>.<span class="ruby-identifier">size</span> <span class="ruby-operator">==</span> <span class="ruby-value">2</span> <span class="ruby-comment"># optional keyword (default value is a literal)</span>
        <span class="ruby-identifier">_key</span>, <span class="ruby-identifier">default_ty</span> = <span class="ruby-operator">*</span><span class="ruby-identifier">kw</span>
        <span class="ruby-identifier">default_ty</span> = <span class="ruby-constant">Type</span>.<span class="ruby-identifier">guess_literal_type</span>(<span class="ruby-identifier">default_ty</span>)
        <span class="ruby-identifier">default_ty</span> = <span class="ruby-identifier">default_ty</span>.<span class="ruby-identifier">base_type</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">default_ty</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Type</span><span class="ruby-operator">::</span><span class="ruby-constant">Literal</span>)
        <span class="ruby-identifier">locals</span>[<span class="ruby-identifier">kw_index</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">i</span>] = <span class="ruby-identifier">default_ty</span>.<span class="ruby-identifier">union</span>(<span class="ruby-constant">Type</span>.<span class="ruby-identifier">any</span>)
      <span class="ruby-keyword">else</span> <span class="ruby-comment"># optional keyword (default value is an expression)</span>
        <span class="ruby-identifier">locals</span>[<span class="ruby-identifier">kw_index</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">i</span>] = <span class="ruby-constant">Type</span>.<span class="ruby-identifier">any</span>
      <span class="ruby-keyword">end</span>
    <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">end</span>
  <span class="ruby-identifier">locals</span>[<span class="ruby-identifier">kwrest_index</span>] = <span class="ruby-constant">Type</span>.<span class="ruby-identifier">any</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">kwrest_index</span>
  <span class="ruby-identifier">locals</span>[<span class="ruby-identifier">block_index</span>] = <span class="ruby-constant">Type</span>.<span class="ruby-identifier">nil</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">block_index</span>

  <span class="ruby-identifier">env</span> = <span class="ruby-constant">Env</span>.<span class="ruby-identifier">new</span>(<span class="ruby-constant">StaticEnv</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">recv</span>, <span class="ruby-constant">Type</span>.<span class="ruby-identifier">nil</span>, <span class="ruby-keyword">false</span>, <span class="ruby-keyword">true</span>), <span class="ruby-identifier">locals</span>, [], <span class="ruby-constant">Utils</span><span class="ruby-operator">::</span><span class="ruby-constant">HashWrapper</span>.<span class="ruby-identifier">new</span>({}))

  <span class="ruby-keyword">if</span> <span class="ruby-operator">!</span><span class="ruby-ivar">@pending_execution</span>[<span class="ruby-identifier">iseq</span>] <span class="ruby-operator">||</span> <span class="ruby-ivar">@pending_execution</span>[<span class="ruby-identifier">iseq</span>][<span class="ruby-value">0</span>] <span class="ruby-operator">==</span> <span class="ruby-value">:block</span>
    <span class="ruby-ivar">@pending_execution</span>[<span class="ruby-identifier">iseq</span>] = [<span class="ruby-value">:method</span>, [<span class="ruby-identifier">meth</span>, <span class="ruby-identifier">ep</span>, <span class="ruby-identifier">env</span>]]
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-report" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">report</span><span
                                class="method-args">(stat_eps, output)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="report-source">
            <pre><span class="ruby-comment"># File typeprof-0.21.8/lib/typeprof/analyzer.rb, line 1115</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">report</span>(<span class="ruby-identifier">stat_eps</span>, <span class="ruby-identifier">output</span>)
  <span class="ruby-constant">Reporters</span>.<span class="ruby-identifier">show_message</span>(<span class="ruby-ivar">@terminated</span>, <span class="ruby-identifier">output</span>)

  <span class="ruby-constant">Reporters</span>.<span class="ruby-identifier">show_error</span>(<span class="ruby-ivar">@errors</span>, <span class="ruby-ivar">@backward_edges</span>, <span class="ruby-identifier">output</span>)

  <span class="ruby-constant">Reporters</span>.<span class="ruby-identifier">show_reveal_types</span>(<span class="ruby-keyword">self</span>, <span class="ruby-ivar">@reveal_types</span>, <span class="ruby-identifier">output</span>)

  <span class="ruby-constant">Reporters</span>.<span class="ruby-identifier">show_gvars</span>(<span class="ruby-keyword">self</span>, <span class="ruby-ivar">@gvar_table</span>, <span class="ruby-identifier">output</span>)

  <span class="ruby-constant">RubySignatureExporter</span>.<span class="ruby-identifier">new</span>(<span class="ruby-keyword">self</span>, <span class="ruby-ivar">@class_defs</span>, <span class="ruby-ivar">@iseq_method_to_ctxs</span>).<span class="ruby-identifier">show</span>(<span class="ruby-identifier">stat_eps</span>, <span class="ruby-identifier">output</span>)
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-report_lsp" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">report_lsp</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="report_lsp-source">
            <pre><span class="ruby-comment"># File typeprof-0.21.8/lib/typeprof/analyzer.rb, line 1127</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">report_lsp</span>
  <span class="ruby-identifier">errs</span> = <span class="ruby-ivar">@errors</span>.<span class="ruby-identifier">map</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">ep</span>, <span class="ruby-identifier">msg</span><span class="ruby-operator">|</span>
    [<span class="ruby-identifier">ep</span>&amp;.<span class="ruby-identifier">detailed_source_location</span>, <span class="ruby-identifier">msg</span>]
  <span class="ruby-keyword">end</span>

  <span class="ruby-identifier">res</span> = <span class="ruby-constant">RubySignatureExporter</span>.<span class="ruby-identifier">new</span>(<span class="ruby-keyword">self</span>, <span class="ruby-ivar">@class_defs</span>, <span class="ruby-ivar">@iseq_method_to_ctxs</span>).<span class="ruby-identifier">show_lsp</span>

  <span class="ruby-identifier">path</span>, <span class="ruby-identifier">loc</span> = <span class="ruby-constant">Config</span>.<span class="ruby-identifier">current</span>.<span class="ruby-identifier">options</span>[<span class="ruby-value">:signature_help_loc</span>]
  <span class="ruby-keyword">if</span> <span class="ruby-identifier">path</span>
    <span class="ruby-identifier">sig_help_res</span> = []
    <span class="ruby-identifier">sig_help</span> = <span class="ruby-ivar">@lsp_signature_help</span>[<span class="ruby-identifier">loc</span>]
    <span class="ruby-keyword">if</span> <span class="ruby-identifier">sig_help</span>
      <span class="ruby-identifier">recv</span> = <span class="ruby-identifier">sig_help</span>[<span class="ruby-value">:recv</span>]
      <span class="ruby-identifier">mid</span> = <span class="ruby-identifier">sig_help</span>[<span class="ruby-value">:mid</span>]
      <span class="ruby-identifier">singleton</span> = <span class="ruby-identifier">sig_help</span>[<span class="ruby-value">:singleton</span>]
      <span class="ruby-identifier">mdefs</span> = <span class="ruby-identifier">sig_help</span>[<span class="ruby-value">:mdefs</span>]
      <span class="ruby-identifier">node_id</span> = <span class="ruby-identifier">sig_help</span>[<span class="ruby-value">:node_id</span>]
      <span class="ruby-identifier">mdefs</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">mdef</span><span class="ruby-operator">|</span>
        <span class="ruby-keyword">case</span> <span class="ruby-identifier">mdef</span>
        <span class="ruby-keyword">when</span> <span class="ruby-constant">ISeqMethodDef</span>
          <span class="ruby-identifier">ctxs</span> = <span class="ruby-ivar">@iseq_method_to_ctxs</span>[<span class="ruby-identifier">mdef</span>]
          <span class="ruby-keyword">next</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">ctxs</span>

          <span class="ruby-identifier">ctx</span> = <span class="ruby-identifier">ctxs</span>.<span class="ruby-identifier">find</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">ctx</span><span class="ruby-operator">|</span> <span class="ruby-identifier">ctx</span>.<span class="ruby-identifier">mid</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">mid</span> } <span class="ruby-operator">||</span> <span class="ruby-identifier">ctxs</span>.<span class="ruby-identifier">first</span>

          <span class="ruby-identifier">method_name</span> = <span class="ruby-identifier">mid</span>
          <span class="ruby-identifier">method_name</span> = <span class="ruby-node">&quot;self.#{ method_name }&quot;</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">singleton</span>

          <span class="ruby-identifier">str</span> = <span class="ruby-identifier">recv</span>.<span class="ruby-identifier">screen_name</span>(<span class="ruby-keyword">self</span>)
          <span class="ruby-identifier">str</span> <span class="ruby-operator">+=</span> <span class="ruby-identifier">singleton</span> <span class="ruby-operator">?</span> <span class="ruby-string">&quot;.&quot;</span> <span class="ruby-operator">:</span> <span class="ruby-string">&quot;#&quot;</span>
          <span class="ruby-identifier">str</span> <span class="ruby-operator">+=</span> <span class="ruby-identifier">method_name</span>.<span class="ruby-identifier">to_s</span>
          <span class="ruby-identifier">str</span> <span class="ruby-operator">+=</span> <span class="ruby-string">&quot;: &quot;</span>
          <span class="ruby-identifier">sig</span>, <span class="ruby-identifier">_</span>, <span class="ruby-identifier">sig_help</span> = <span class="ruby-identifier">show_method_signature</span>(<span class="ruby-identifier">ctx</span>)
          <span class="ruby-identifier">offset</span> = <span class="ruby-identifier">str</span>.<span class="ruby-identifier">size</span>
          <span class="ruby-identifier">sig_help</span> = <span class="ruby-identifier">sig_help</span>.<span class="ruby-identifier">transform_values</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">r</span><span class="ruby-operator">|</span> (<span class="ruby-identifier">r</span>.<span class="ruby-identifier">begin</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">offset</span> <span class="ruby-operator">...</span> <span class="ruby-identifier">r</span>.<span class="ruby-identifier">end</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">offset</span>) }
          <span class="ruby-identifier">str</span> <span class="ruby-operator">+=</span> <span class="ruby-identifier">sig</span>
          <span class="ruby-identifier">sig_help_res</span> <span class="ruby-operator">&lt;&lt;</span> [<span class="ruby-identifier">str</span>, <span class="ruby-identifier">sig_help</span>, <span class="ruby-identifier">node_id</span>]
        <span class="ruby-keyword">when</span> <span class="ruby-constant">AliasMethodDef</span>
          <span class="ruby-comment"># TODO</span>
        <span class="ruby-keyword">when</span> <span class="ruby-constant">TypedMethodDef</span>
          <span class="ruby-identifier">mdef</span>.<span class="ruby-identifier">rbs_source</span>&amp;.<span class="ruby-identifier">[]</span>(<span class="ruby-value">1</span>)&amp;.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">rbs</span><span class="ruby-operator">|</span>
            <span class="ruby-comment"># TODO: sig_help</span>
            <span class="ruby-identifier">sig_help_res</span> <span class="ruby-operator">&lt;&lt;</span> [<span class="ruby-identifier">rbs</span>, {}, <span class="ruby-identifier">node_id</span>]
          <span class="ruby-keyword">end</span>
        <span class="ruby-keyword">end</span>
      <span class="ruby-keyword">end</span>
    <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">end</span>

  {
    <span class="ruby-value">sigs:</span> <span class="ruby-identifier">res</span>,
    <span class="ruby-value">errors:</span> <span class="ruby-identifier">errs</span>,
    <span class="ruby-value">completion:</span> <span class="ruby-ivar">@lsp_completion</span>,
    <span class="ruby-value">signature_help:</span> <span class="ruby-identifier">sig_help_res</span>,
  }
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-reveal_type" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">reveal_type</span><span
                                class="method-args">(ep, ty)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="reveal_type-source">
            <pre><span class="ruby-comment"># File typeprof-0.21.8/lib/typeprof/analyzer.rb, line 964</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">reveal_type</span>(<span class="ruby-identifier">ep</span>, <span class="ruby-identifier">ty</span>)
  <span class="ruby-identifier">key</span> = <span class="ruby-identifier">ep</span>.<span class="ruby-identifier">source_location</span>
  <span class="ruby-identifier">puts</span> <span class="ruby-node">&quot;reveal:#{ ep.source_location }:#{ ty.screen_name(self) }&quot;</span> <span class="ruby-keyword">if</span> <span class="ruby-constant">Config</span>.<span class="ruby-identifier">current</span>.<span class="ruby-identifier">verbose</span> <span class="ruby-operator">&gt;=</span> <span class="ruby-value">2</span>
  <span class="ruby-keyword">if</span> <span class="ruby-ivar">@reveal_types</span>[<span class="ruby-identifier">key</span>]
    <span class="ruby-ivar">@reveal_types</span>[<span class="ruby-identifier">key</span>] = <span class="ruby-ivar">@reveal_types</span>[<span class="ruby-identifier">key</span>].<span class="ruby-identifier">union</span>(<span class="ruby-identifier">ty</span>)
  <span class="ruby-keyword">else</span>
    <span class="ruby-ivar">@reveal_types</span>[<span class="ruby-identifier">key</span>] = <span class="ruby-identifier">ty</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-search_constant" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">search_constant</span><span
                                class="method-args">(cref, name)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="search_constant-source">
            <pre><span class="ruby-comment"># File typeprof-0.21.8/lib/typeprof/analyzer.rb, line 695</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">search_constant</span>(<span class="ruby-identifier">cref</span>, <span class="ruby-identifier">name</span>)
  <span class="ruby-keyword">while</span> <span class="ruby-identifier">cref</span> <span class="ruby-operator">!=</span> <span class="ruby-value">:bottom</span>
    <span class="ruby-identifier">ty</span>, <span class="ruby-identifier">locs</span> = <span class="ruby-identifier">get_constant</span>(<span class="ruby-identifier">cref</span>.<span class="ruby-identifier">klass</span>, <span class="ruby-identifier">name</span>)
    <span class="ruby-keyword">return</span> <span class="ruby-identifier">ty</span>, <span class="ruby-identifier">locs</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">ty</span> <span class="ruby-operator">!=</span> <span class="ruby-constant">Type</span>.<span class="ruby-identifier">any</span>
    <span class="ruby-identifier">cref</span> = <span class="ruby-identifier">cref</span>.<span class="ruby-identifier">outer</span>
  <span class="ruby-keyword">end</span>

  <span class="ruby-keyword">return</span> <span class="ruby-constant">Type</span>.<span class="ruby-identifier">any</span>, <span class="ruby-keyword">nil</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-search_method" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">search_method</span><span
                                class="method-args">(klass, singleton, mid, &amp;blk)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="search_method-source">
            <pre><span class="ruby-comment"># File typeprof-0.21.8/lib/typeprof/analyzer.rb, line 599</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">search_method</span>(<span class="ruby-identifier">klass</span>, <span class="ruby-identifier">singleton</span>, <span class="ruby-identifier">mid</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">blk</span>)
  <span class="ruby-comment"># XXX: support method alias correctly</span>
  <span class="ruby-identifier">klass_orig</span> = <span class="ruby-identifier">klass</span>
  <span class="ruby-keyword">if</span> <span class="ruby-identifier">klass</span>.<span class="ruby-identifier">kind</span> <span class="ruby-operator">==</span> <span class="ruby-value">:class</span>
    <span class="ruby-keyword">while</span> <span class="ruby-identifier">klass</span> <span class="ruby-operator">!=</span> <span class="ruby-value">:__root__</span>
      <span class="ruby-identifier">class_def</span> = <span class="ruby-ivar">@class_defs</span>[<span class="ruby-identifier">klass</span>.<span class="ruby-identifier">idx</span>]
      <span class="ruby-identifier">class_def</span>.<span class="ruby-identifier">search_method</span>(<span class="ruby-identifier">singleton</span>, <span class="ruby-identifier">mid</span>, {}, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">blk</span>)
      <span class="ruby-identifier">klass</span> = <span class="ruby-identifier">klass</span>.<span class="ruby-identifier">superclass</span>
    <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">else</span>
    <span class="ruby-comment"># module</span>
    <span class="ruby-identifier">class_def</span> = <span class="ruby-ivar">@class_defs</span>[<span class="ruby-identifier">klass</span>.<span class="ruby-identifier">idx</span>]
    <span class="ruby-identifier">class_def</span>.<span class="ruby-identifier">search_method</span>(<span class="ruby-identifier">singleton</span>, <span class="ruby-identifier">mid</span>, {}, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">blk</span>)
  <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">if</span> <span class="ruby-identifier">singleton</span>
    <span class="ruby-identifier">search_method</span>(<span class="ruby-constant">Type</span><span class="ruby-operator">::</span><span class="ruby-constant">Builtin</span>[<span class="ruby-identifier">klass_orig</span>.<span class="ruby-identifier">kind</span>], <span class="ruby-keyword">false</span>, <span class="ruby-identifier">mid</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">blk</span>)
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-set_custom_method" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">set_custom_method</span><span
                                class="method-args">(klass, mid, impl, pub_meth = true)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="set_custom_method-source">
            <pre><span class="ruby-comment"># File typeprof-0.21.8/lib/typeprof/analyzer.rb, line 759</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">set_custom_method</span>(<span class="ruby-identifier">klass</span>, <span class="ruby-identifier">mid</span>, <span class="ruby-identifier">impl</span>, <span class="ruby-identifier">pub_meth</span> = <span class="ruby-keyword">true</span>)
  <span class="ruby-identifier">set_method</span>(<span class="ruby-identifier">klass</span>, <span class="ruby-identifier">mid</span>, <span class="ruby-keyword">false</span>, <span class="ruby-constant">CustomMethodDef</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">impl</span>, <span class="ruby-identifier">pub_meth</span>))
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-set_instance_variable" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">set_instance_variable</span><span
                                class="method-args">(recv, var, ty, ep, env)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="set_instance_variable-source">
            <pre><span class="ruby-comment"># File typeprof-0.21.8/lib/typeprof/analyzer.rb, line 1280</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">set_instance_variable</span>(<span class="ruby-identifier">recv</span>, <span class="ruby-identifier">var</span>, <span class="ruby-identifier">ty</span>, <span class="ruby-identifier">ep</span>, <span class="ruby-identifier">env</span>)
  <span class="ruby-identifier">ty</span> = <span class="ruby-identifier">globalize_type</span>(<span class="ruby-identifier">ty</span>, <span class="ruby-identifier">env</span>, <span class="ruby-identifier">ep</span>)
  <span class="ruby-identifier">add_ivar_write!</span>(<span class="ruby-identifier">recv</span>, <span class="ruby-identifier">var</span>, <span class="ruby-identifier">ty</span>, <span class="ruby-identifier">ep</span>)
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-set_method" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">set_method</span><span
                                class="method-args">(klass, mid, singleton, mdef)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="set_method-source">
            <pre><span class="ruby-comment"># File typeprof-0.21.8/lib/typeprof/analyzer.rb, line 724</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">set_method</span>(<span class="ruby-identifier">klass</span>, <span class="ruby-identifier">mid</span>, <span class="ruby-identifier">singleton</span>, <span class="ruby-identifier">mdef</span>)
  <span class="ruby-ivar">@class_defs</span>[<span class="ruby-identifier">klass</span>.<span class="ruby-identifier">idx</span>].<span class="ruby-identifier">set_method</span>(<span class="ruby-identifier">mid</span>, <span class="ruby-identifier">singleton</span>, <span class="ruby-identifier">mdef</span>)
  <span class="ruby-identifier">mdef</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-set_singleton_custom_method" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">set_singleton_custom_method</span><span
                                class="method-args">(klass, mid, impl, pub_meth = true)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="set_singleton_custom_method-source">
            <pre><span class="ruby-comment"># File typeprof-0.21.8/lib/typeprof/analyzer.rb, line 763</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">set_singleton_custom_method</span>(<span class="ruby-identifier">klass</span>, <span class="ruby-identifier">mid</span>, <span class="ruby-identifier">impl</span>, <span class="ruby-identifier">pub_meth</span> = <span class="ruby-keyword">true</span>)
  <span class="ruby-identifier">set_method</span>(<span class="ruby-identifier">klass</span>, <span class="ruby-identifier">mid</span>, <span class="ruby-keyword">true</span>, <span class="ruby-constant">CustomMethodDef</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">impl</span>, <span class="ruby-identifier">pub_meth</span>))
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-show_block_signature" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">show_block_signature</span><span
                                class="method-args">(blks)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="show_block_signature-source">
            <pre><span class="ruby-comment"># File typeprof-0.21.8/lib/typeprof/analyzer.rb, line 2501</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">show_block_signature</span>(<span class="ruby-identifier">blks</span>)
  <span class="ruby-identifier">bsig</span> = <span class="ruby-keyword">nil</span>
  <span class="ruby-identifier">ret_ty</span> = <span class="ruby-constant">Type</span>.<span class="ruby-identifier">bot</span>

  <span class="ruby-identifier">blks</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">blk</span><span class="ruby-operator">|</span>
    <span class="ruby-identifier">blk</span>.<span class="ruby-identifier">each_child_global</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">blk</span><span class="ruby-operator">|</span>
      <span class="ruby-identifier">bsig0</span> = <span class="ruby-ivar">@block_signatures</span>[<span class="ruby-identifier">blk</span>.<span class="ruby-identifier">block_body</span>]
      <span class="ruby-keyword">if</span> <span class="ruby-identifier">bsig0</span>
        <span class="ruby-keyword">if</span> <span class="ruby-identifier">bsig</span>
          <span class="ruby-identifier">bsig</span> = <span class="ruby-identifier">bsig</span>.<span class="ruby-identifier">merge</span>(<span class="ruby-identifier">bsig0</span>)
        <span class="ruby-keyword">else</span>
          <span class="ruby-identifier">bsig</span> = <span class="ruby-identifier">bsig0</span>
        <span class="ruby-keyword">end</span>
      <span class="ruby-keyword">end</span>

      <span class="ruby-ivar">@block_to_ctx</span>[<span class="ruby-identifier">blk</span>.<span class="ruby-identifier">block_body</span>]&amp;.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">blk_ctx</span><span class="ruby-operator">|</span>
        <span class="ruby-identifier">ret_ty</span> = <span class="ruby-identifier">ret_ty</span>.<span class="ruby-identifier">union</span>(<span class="ruby-ivar">@return_values</span>[<span class="ruby-identifier">blk_ctx</span>]) <span class="ruby-keyword">if</span> <span class="ruby-ivar">@return_values</span>[<span class="ruby-identifier">blk_ctx</span>]
      <span class="ruby-keyword">end</span>
    <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">end</span>

  <span class="ruby-identifier">bsig</span> <span class="ruby-operator">||=</span> <span class="ruby-constant">BlockSignature</span>.<span class="ruby-identifier">new</span>([], [], <span class="ruby-keyword">nil</span>, <span class="ruby-constant">Type</span>.<span class="ruby-identifier">nil</span>)

  <span class="ruby-identifier">bsig</span>, = <span class="ruby-identifier">bsig</span>.<span class="ruby-identifier">screen_name</span>(<span class="ruby-keyword">nil</span>, <span class="ruby-keyword">self</span>)
  <span class="ruby-identifier">ret_ty</span> = <span class="ruby-identifier">ret_ty</span>.<span class="ruby-identifier">screen_name</span>(<span class="ruby-keyword">self</span>)
  <span class="ruby-identifier">ret_ty</span> = (<span class="ruby-identifier">ret_ty</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-string">&quot;|&quot;</span>) <span class="ruby-operator">?</span> <span class="ruby-node">&quot;(#{ ret_ty })&quot;</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">ret_ty</span>) <span class="ruby-comment"># XXX?</span>

  <span class="ruby-identifier">bsig</span> = <span class="ruby-identifier">bsig</span> <span class="ruby-operator">+</span> <span class="ruby-string">&quot; &quot;</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">bsig</span> <span class="ruby-operator">!=</span> <span class="ruby-string">&quot;&quot;</span>
  <span class="ruby-node">&quot;{ #{ bsig }-&gt; #{ ret_ty } }&quot;</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-show_method_signature" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">show_method_signature</span><span
                                class="method-args">(ctx)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="show_method_signature-source">
            <pre><span class="ruby-comment"># File typeprof-0.21.8/lib/typeprof/analyzer.rb, line 2570</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">show_method_signature</span>(<span class="ruby-identifier">ctx</span>)
  <span class="ruby-identifier">farg_tys</span> = <span class="ruby-ivar">@method_signatures</span>[<span class="ruby-identifier">ctx</span>]
  <span class="ruby-keyword">return</span> <span class="ruby-keyword">nil</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">farg_tys</span>
  <span class="ruby-identifier">ret_ty</span> = <span class="ruby-identifier">ctx</span>.<span class="ruby-identifier">mid</span> <span class="ruby-operator">==</span> <span class="ruby-value">:initialize</span> <span class="ruby-operator">?</span> <span class="ruby-constant">Type</span><span class="ruby-operator">::</span><span class="ruby-constant">Void</span>.<span class="ruby-identifier">new</span> <span class="ruby-operator">:</span> <span class="ruby-ivar">@return_values</span>[<span class="ruby-identifier">ctx</span>] <span class="ruby-operator">||</span> <span class="ruby-constant">Type</span>.<span class="ruby-identifier">bot</span>

  <span class="ruby-identifier">untyped</span> = <span class="ruby-identifier">farg_tys</span>.<span class="ruby-identifier">include_untyped?</span>(<span class="ruby-keyword">self</span>) <span class="ruby-operator">||</span> <span class="ruby-identifier">ret_ty</span>.<span class="ruby-identifier">include_untyped?</span>(<span class="ruby-keyword">self</span>)

  <span class="ruby-identifier">farg_tys</span>, <span class="ruby-identifier">ranges</span> = <span class="ruby-identifier">farg_tys</span>.<span class="ruby-identifier">screen_name</span>(<span class="ruby-identifier">ctx</span>.<span class="ruby-identifier">iseq</span>, <span class="ruby-keyword">self</span>)
  <span class="ruby-identifier">ret_ty</span> = <span class="ruby-identifier">ret_ty</span>.<span class="ruby-identifier">screen_name</span>(<span class="ruby-keyword">self</span>)
  <span class="ruby-identifier">ret_ty</span> = (<span class="ruby-identifier">ret_ty</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-string">&quot;|&quot;</span>) <span class="ruby-operator">?</span> <span class="ruby-node">&quot;(#{ ret_ty })&quot;</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">ret_ty</span>) <span class="ruby-comment"># XXX?</span>

  <span class="ruby-keyword">return</span> <span class="ruby-node">&quot;#{ (farg_tys.empty? ? &quot;&quot; : &quot;#{ farg_tys } &quot;) }-&gt; #{ ret_ty }&quot;</span>, <span class="ruby-identifier">untyped</span>, <span class="ruby-identifier">ranges</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-show_proc_signature" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">show_proc_signature</span><span
                                class="method-args">(blks)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="show_proc_signature-source">
            <pre><span class="ruby-comment"># File typeprof-0.21.8/lib/typeprof/analyzer.rb, line 2532</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">show_proc_signature</span>(<span class="ruby-identifier">blks</span>)
  <span class="ruby-identifier">farg_tys</span>, <span class="ruby-identifier">ret_ty</span> = <span class="ruby-keyword">nil</span>, <span class="ruby-constant">Type</span>.<span class="ruby-identifier">bot</span>

  <span class="ruby-identifier">blks</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">blk</span><span class="ruby-operator">|</span>
    <span class="ruby-identifier">blk</span>.<span class="ruby-identifier">each_child_global</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">blk</span><span class="ruby-operator">|</span>
      <span class="ruby-keyword">next</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">blk</span>.<span class="ruby-identifier">block_body</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">TypedBlock</span>) <span class="ruby-comment"># XXX: Support TypedBlock</span>
      <span class="ruby-keyword">next</span> <span class="ruby-keyword">unless</span> <span class="ruby-ivar">@block_to_ctx</span>[<span class="ruby-identifier">blk</span>.<span class="ruby-identifier">block_body</span>] <span class="ruby-comment"># this occurs when screen_name is called before type-profiling finished (e.g., error message)</span>
      <span class="ruby-ivar">@block_to_ctx</span>[<span class="ruby-identifier">blk</span>.<span class="ruby-identifier">block_body</span>].<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">blk_ctx</span><span class="ruby-operator">|</span>
        <span class="ruby-keyword">if</span> <span class="ruby-identifier">farg_tys</span>
          <span class="ruby-keyword">if</span> <span class="ruby-ivar">@method_signatures</span>[<span class="ruby-identifier">blk_ctx</span>]
            <span class="ruby-identifier">farg_tys</span> = <span class="ruby-identifier">farg_tys</span>.<span class="ruby-identifier">merge_as_block_arguments</span>(<span class="ruby-ivar">@method_signatures</span>[<span class="ruby-identifier">blk_ctx</span>])
          <span class="ruby-keyword">else</span>
            <span class="ruby-comment"># this occurs when screen_name is called before type-profiling finished (e.g., error message)</span>
          <span class="ruby-keyword">end</span>
        <span class="ruby-keyword">else</span>
          <span class="ruby-identifier">farg_tys</span> = <span class="ruby-ivar">@method_signatures</span>[<span class="ruby-identifier">blk_ctx</span>]
        <span class="ruby-keyword">end</span>

        <span class="ruby-identifier">ret_ty</span> = <span class="ruby-identifier">ret_ty</span>.<span class="ruby-identifier">union</span>(<span class="ruby-ivar">@return_values</span>[<span class="ruby-identifier">blk_ctx</span>]) <span class="ruby-keyword">if</span> <span class="ruby-ivar">@return_values</span>[<span class="ruby-identifier">blk_ctx</span>]
      <span class="ruby-keyword">end</span>
    <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">end</span>

  <span class="ruby-keyword">return</span> <span class="ruby-constant">Type</span>.<span class="ruby-identifier">any</span>.<span class="ruby-identifier">screen_name</span>(<span class="ruby-keyword">self</span>) <span class="ruby-keyword">if</span> <span class="ruby-ivar">@types_being_shown</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">farg_tys</span>) <span class="ruby-operator">||</span> <span class="ruby-ivar">@types_being_shown</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">ret_ty</span>)

  <span class="ruby-keyword">begin</span>
    <span class="ruby-ivar">@types_being_shown</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">farg_tys</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">ret_ty</span>
    <span class="ruby-identifier">farg_tys</span>, = <span class="ruby-identifier">farg_tys</span> <span class="ruby-operator">?</span> <span class="ruby-identifier">farg_tys</span>.<span class="ruby-identifier">screen_name</span>(<span class="ruby-keyword">nil</span>, <span class="ruby-keyword">self</span>) <span class="ruby-operator">:</span> [<span class="ruby-string">&quot;(unknown)&quot;</span>]
    <span class="ruby-identifier">ret_ty</span> = <span class="ruby-identifier">ret_ty</span>.<span class="ruby-identifier">screen_name</span>(<span class="ruby-keyword">self</span>)
    <span class="ruby-identifier">ret_ty</span> = (<span class="ruby-identifier">ret_ty</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-string">&quot;|&quot;</span>) <span class="ruby-operator">?</span> <span class="ruby-node">&quot;(#{ ret_ty })&quot;</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">ret_ty</span>) <span class="ruby-comment"># XXX?</span>

    <span class="ruby-identifier">farg_tys</span> = <span class="ruby-identifier">farg_tys</span> <span class="ruby-operator">+</span> <span class="ruby-string">&quot; &quot;</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">farg_tys</span> <span class="ruby-operator">!=</span> <span class="ruby-string">&quot;&quot;</span>
    <span class="ruby-node">&quot;^#{ farg_tys }-&gt; #{ ret_ty }&quot;</span>
  <span class="ruby-keyword">ensure</span>
    <span class="ruby-ivar">@types_being_shown</span>.<span class="ruby-identifier">pop</span>(<span class="ruby-value">2</span>)
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-step" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">step</span><span
                                class="method-args">(ep)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="step-source">
            <pre><span class="ruby-comment"># File typeprof-0.21.8/lib/typeprof/analyzer.rb, line 1285</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">step</span>(<span class="ruby-identifier">ep</span>)
  <span class="ruby-identifier">env</span> = <span class="ruby-ivar">@ep2env</span>[<span class="ruby-identifier">ep</span>]
  <span class="ruby-identifier">raise</span> <span class="ruby-string">&quot;nil env&quot;</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">env</span>

  <span class="ruby-identifier">insn</span> = <span class="ruby-identifier">ep</span>.<span class="ruby-identifier">ctx</span>.<span class="ruby-identifier">iseq</span>.<span class="ruby-identifier">insns</span>[<span class="ruby-identifier">ep</span>.<span class="ruby-identifier">pc</span>]
  <span class="ruby-identifier">operands</span> = <span class="ruby-identifier">insn</span>.<span class="ruby-identifier">operands</span>

  <span class="ruby-keyword">if</span> <span class="ruby-constant">Config</span>.<span class="ruby-identifier">current</span>.<span class="ruby-identifier">verbose</span> <span class="ruby-operator">&gt;=</span> <span class="ruby-value">2</span>
    <span class="ruby-comment"># XXX: more dedicated output</span>
    <span class="ruby-identifier">puts</span> <span class="ruby-string">&quot;DEBUG: stack=%p&quot;</span> <span class="ruby-operator">%</span> [<span class="ruby-identifier">env</span>.<span class="ruby-identifier">stack</span>]
    <span class="ruby-identifier">puts</span> <span class="ruby-string">&quot;DEBUG: %s (%s) PC=%d insn=%s sp=%d&quot;</span> <span class="ruby-operator">%</span> [<span class="ruby-identifier">ep</span>.<span class="ruby-identifier">source_location</span>, <span class="ruby-identifier">ep</span>.<span class="ruby-identifier">ctx</span>.<span class="ruby-identifier">iseq</span>.<span class="ruby-identifier">name</span>, <span class="ruby-identifier">ep</span>.<span class="ruby-identifier">pc</span>, <span class="ruby-identifier">insn</span>.<span class="ruby-identifier">insn</span>, <span class="ruby-identifier">env</span>.<span class="ruby-identifier">stack</span>.<span class="ruby-identifier">size</span>]
  <span class="ruby-keyword">end</span>

  <span class="ruby-keyword">case</span> <span class="ruby-identifier">insn</span>.<span class="ruby-identifier">insn</span>
  <span class="ruby-keyword">when</span> <span class="ruby-value">:_iseq_body_start</span>
    <span class="ruby-comment"># XXX: reconstruct and record the method signature</span>
    <span class="ruby-identifier">iseq</span> = <span class="ruby-identifier">ep</span>.<span class="ruby-identifier">ctx</span>.<span class="ruby-identifier">iseq</span>
    <span class="ruby-identifier">lead_num</span> = <span class="ruby-identifier">iseq</span>.<span class="ruby-identifier">fargs_format</span>[<span class="ruby-value">:lead_num</span>] <span class="ruby-operator">||</span> <span class="ruby-value">0</span>
    <span class="ruby-identifier">opt</span> = <span class="ruby-identifier">iseq</span>.<span class="ruby-identifier">fargs_format</span>[<span class="ruby-value">:opt</span>] <span class="ruby-operator">||</span> [<span class="ruby-value">0</span>]
    <span class="ruby-identifier">rest_start</span> = <span class="ruby-identifier">iseq</span>.<span class="ruby-identifier">fargs_format</span>[<span class="ruby-value">:rest_start</span>]
    <span class="ruby-identifier">post_start</span> = <span class="ruby-identifier">iseq</span>.<span class="ruby-identifier">fargs_format</span>[<span class="ruby-value">:post_start</span>]
    <span class="ruby-identifier">post_num</span> = <span class="ruby-identifier">iseq</span>.<span class="ruby-identifier">fargs_format</span>[<span class="ruby-value">:post_num</span>] <span class="ruby-operator">||</span> <span class="ruby-value">0</span>
    <span class="ruby-identifier">kw_start</span> = <span class="ruby-identifier">iseq</span>.<span class="ruby-identifier">fargs_format</span>[<span class="ruby-value">:kwbits</span>]
    <span class="ruby-identifier">keyword</span> = <span class="ruby-identifier">iseq</span>.<span class="ruby-identifier">fargs_format</span>[<span class="ruby-value">:keyword</span>]
    <span class="ruby-identifier">kw_start</span> <span class="ruby-operator">-=</span> <span class="ruby-identifier">keyword</span>.<span class="ruby-identifier">size</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">kw_start</span>
    <span class="ruby-identifier">kw_rest</span> = <span class="ruby-identifier">iseq</span>.<span class="ruby-identifier">fargs_format</span>[<span class="ruby-value">:kwrest</span>]
    <span class="ruby-identifier">block_start</span> = <span class="ruby-identifier">iseq</span>.<span class="ruby-identifier">fargs_format</span>[<span class="ruby-value">:block_start</span>]

    <span class="ruby-identifier">lead_tys</span> = <span class="ruby-identifier">env</span>.<span class="ruby-identifier">locals</span>[<span class="ruby-value">0</span>, <span class="ruby-identifier">lead_num</span>].<span class="ruby-identifier">map</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">ty</span><span class="ruby-operator">|</span> <span class="ruby-identifier">globalize_type</span>(<span class="ruby-identifier">ty</span>, <span class="ruby-identifier">env</span>, <span class="ruby-identifier">ep</span>) }
    <span class="ruby-identifier">opt_tys</span> = <span class="ruby-identifier">opt</span>.<span class="ruby-identifier">size</span> <span class="ruby-operator">&gt;</span> <span class="ruby-value">1</span> <span class="ruby-operator">?</span> <span class="ruby-identifier">env</span>.<span class="ruby-identifier">locals</span>[<span class="ruby-identifier">lead_num</span>, <span class="ruby-identifier">opt</span>.<span class="ruby-identifier">size</span> <span class="ruby-operator">-</span> <span class="ruby-value">1</span>].<span class="ruby-identifier">map</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">ty</span><span class="ruby-operator">|</span> <span class="ruby-identifier">globalize_type</span>(<span class="ruby-identifier">ty</span>, <span class="ruby-identifier">env</span>, <span class="ruby-identifier">ep</span>) } <span class="ruby-operator">:</span> []
    <span class="ruby-keyword">if</span> <span class="ruby-identifier">rest_start</span> <span class="ruby-comment"># XXX:squash</span>
      <span class="ruby-identifier">ty</span> = <span class="ruby-identifier">globalize_type</span>(<span class="ruby-identifier">env</span>.<span class="ruby-identifier">locals</span>[<span class="ruby-identifier">rest_start</span>], <span class="ruby-identifier">env</span>, <span class="ruby-identifier">ep</span>)
      <span class="ruby-identifier">rest_ty</span> = <span class="ruby-constant">Type</span>.<span class="ruby-identifier">bot</span>
      <span class="ruby-identifier">ty</span>.<span class="ruby-identifier">each_child_global</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">ty</span><span class="ruby-operator">|</span>
        <span class="ruby-keyword">if</span> <span class="ruby-identifier">ty</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Type</span><span class="ruby-operator">::</span><span class="ruby-constant">Array</span>)
          <span class="ruby-identifier">rest_ty</span> = <span class="ruby-identifier">rest_ty</span>.<span class="ruby-identifier">union</span>(<span class="ruby-identifier">ty</span>.<span class="ruby-identifier">elems</span>.<span class="ruby-identifier">squash</span>)
        <span class="ruby-keyword">else</span>
          <span class="ruby-comment"># XXX: to_ary?</span>
          <span class="ruby-identifier">rest_ty</span> = <span class="ruby-identifier">rest_ty</span>.<span class="ruby-identifier">union</span>(<span class="ruby-identifier">ty</span>)
        <span class="ruby-keyword">end</span>
      <span class="ruby-keyword">end</span>
    <span class="ruby-keyword">end</span>
    <span class="ruby-identifier">post_tys</span> = (<span class="ruby-identifier">post_start</span> <span class="ruby-operator">?</span> <span class="ruby-identifier">env</span>.<span class="ruby-identifier">locals</span>[<span class="ruby-identifier">post_start</span>, <span class="ruby-identifier">post_num</span>] <span class="ruby-operator">:</span> []).<span class="ruby-identifier">map</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">ty</span><span class="ruby-operator">|</span> <span class="ruby-identifier">globalize_type</span>(<span class="ruby-identifier">ty</span>, <span class="ruby-identifier">env</span>, <span class="ruby-identifier">ep</span>) }
    <span class="ruby-keyword">if</span> <span class="ruby-identifier">keyword</span>
      <span class="ruby-identifier">kw_tys</span> = []
      <span class="ruby-identifier">keyword</span>.<span class="ruby-identifier">each_with_index</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">kw</span>, <span class="ruby-identifier">i</span><span class="ruby-operator">|</span>
        <span class="ruby-keyword">case</span>
        <span class="ruby-keyword">when</span> <span class="ruby-identifier">kw</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Symbol</span>) <span class="ruby-comment"># required keyword</span>
          <span class="ruby-identifier">key</span> = <span class="ruby-identifier">kw</span>
          <span class="ruby-identifier">req</span> = <span class="ruby-keyword">true</span>
        <span class="ruby-keyword">when</span> <span class="ruby-identifier">kw</span>.<span class="ruby-identifier">size</span> <span class="ruby-operator">==</span> <span class="ruby-value">2</span> <span class="ruby-comment"># optional keyword (default value is a literal)</span>
          <span class="ruby-identifier">key</span>, <span class="ruby-identifier">default_ty</span> = <span class="ruby-operator">*</span><span class="ruby-identifier">kw</span>
          <span class="ruby-identifier">default_ty</span> = <span class="ruby-constant">Type</span>.<span class="ruby-identifier">guess_literal_type</span>(<span class="ruby-identifier">default_ty</span>)
          <span class="ruby-identifier">default_ty</span> = <span class="ruby-identifier">default_ty</span>.<span class="ruby-identifier">base_type</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">default_ty</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Type</span><span class="ruby-operator">::</span><span class="ruby-constant">Literal</span>)
          <span class="ruby-identifier">req</span> = <span class="ruby-keyword">false</span>
        <span class="ruby-keyword">else</span> <span class="ruby-comment"># optional keyword (default value is an expression)</span>
          <span class="ruby-identifier">key</span>, = <span class="ruby-identifier">kw</span>
          <span class="ruby-identifier">req</span> = <span class="ruby-keyword">false</span>
        <span class="ruby-keyword">end</span>
        <span class="ruby-identifier">ty</span> = <span class="ruby-identifier">env</span>.<span class="ruby-identifier">locals</span>[<span class="ruby-identifier">kw_start</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">i</span>]
        <span class="ruby-identifier">ty</span> = <span class="ruby-identifier">ty</span>.<span class="ruby-identifier">union</span>(<span class="ruby-identifier">default_ty</span>) <span class="ruby-keyword">if</span> <span class="ruby-identifier">default_ty</span>
        <span class="ruby-identifier">ty</span> = <span class="ruby-identifier">globalize_type</span>(<span class="ruby-identifier">ty</span>, <span class="ruby-identifier">env</span>, <span class="ruby-identifier">ep</span>)
        <span class="ruby-identifier">kw_tys</span> <span class="ruby-operator">&lt;&lt;</span> [<span class="ruby-identifier">req</span>, <span class="ruby-identifier">key</span>, <span class="ruby-identifier">ty</span>]
      <span class="ruby-keyword">end</span>
    <span class="ruby-keyword">end</span>
    <span class="ruby-identifier">kw_rest_ty</span> = <span class="ruby-identifier">globalize_type</span>(<span class="ruby-identifier">env</span>.<span class="ruby-identifier">locals</span>[<span class="ruby-identifier">kw_rest</span>], <span class="ruby-identifier">env</span>, <span class="ruby-identifier">ep</span>) <span class="ruby-keyword">if</span> <span class="ruby-identifier">kw_rest</span>
    <span class="ruby-identifier">kw_rest_ty</span> = <span class="ruby-keyword">nil</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">kw_rest_ty</span> <span class="ruby-operator">==</span> <span class="ruby-constant">Type</span>.<span class="ruby-identifier">nil</span>
    <span class="ruby-keyword">if</span> <span class="ruby-identifier">block_start</span>
      <span class="ruby-identifier">blk_ty</span> = <span class="ruby-identifier">globalize_type</span>(<span class="ruby-identifier">env</span>.<span class="ruby-identifier">locals</span>[<span class="ruby-identifier">block_start</span>], <span class="ruby-identifier">env</span>, <span class="ruby-identifier">ep</span>)
    <span class="ruby-keyword">elsif</span> <span class="ruby-identifier">iseq</span>.<span class="ruby-identifier">type</span> <span class="ruby-operator">==</span> <span class="ruby-value">:method</span>
      <span class="ruby-identifier">blk_ty</span> = <span class="ruby-identifier">env</span>.<span class="ruby-identifier">static_env</span>.<span class="ruby-identifier">blk_ty</span>
    <span class="ruby-keyword">else</span>
      <span class="ruby-identifier">blk_ty</span> = <span class="ruby-constant">Type</span>.<span class="ruby-identifier">nil</span>
    <span class="ruby-keyword">end</span>
    <span class="ruby-identifier">msig</span> = <span class="ruby-constant">MethodSignature</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">lead_tys</span>, <span class="ruby-identifier">opt_tys</span>, <span class="ruby-identifier">rest_ty</span>, <span class="ruby-identifier">post_tys</span>, <span class="ruby-identifier">kw_tys</span>, <span class="ruby-identifier">kw_rest_ty</span>, <span class="ruby-identifier">blk_ty</span>)
    <span class="ruby-identifier">add_method_signature!</span>(<span class="ruby-identifier">ep</span>.<span class="ruby-identifier">ctx</span>, <span class="ruby-identifier">msig</span>)
  <span class="ruby-keyword">when</span> <span class="ruby-value">:putspecialobject</span>
    <span class="ruby-identifier">kind</span>, = <span class="ruby-identifier">operands</span>
    <span class="ruby-identifier">ty</span> = <span class="ruby-keyword">case</span> <span class="ruby-identifier">kind</span>
    <span class="ruby-keyword">when</span> <span class="ruby-value">1</span> <span class="ruby-keyword">then</span> <span class="ruby-constant">Type</span><span class="ruby-operator">::</span><span class="ruby-constant">Instance</span>.<span class="ruby-identifier">new</span>(<span class="ruby-constant">Type</span><span class="ruby-operator">::</span><span class="ruby-constant">Builtin</span>[<span class="ruby-value">:vmcore</span>])
    <span class="ruby-keyword">when</span> <span class="ruby-value">2</span>, <span class="ruby-value">3</span> <span class="ruby-comment"># CBASE / CONSTBASE</span>
      <span class="ruby-identifier">ep</span>.<span class="ruby-identifier">ctx</span>.<span class="ruby-identifier">cref</span>.<span class="ruby-identifier">klass</span>
    <span class="ruby-keyword">else</span>
      <span class="ruby-identifier">raise</span> <span class="ruby-constant">NotImplementedError</span>, <span class="ruby-node">&quot;unknown special object: #{ type }&quot;</span>
    <span class="ruby-keyword">end</span>
    <span class="ruby-identifier">env</span> = <span class="ruby-identifier">env</span>.<span class="ruby-identifier">push</span>(<span class="ruby-identifier">ty</span>)
  <span class="ruby-keyword">when</span> <span class="ruby-value">:putnil</span>
    <span class="ruby-identifier">env</span> = <span class="ruby-identifier">env</span>.<span class="ruby-identifier">push</span>(<span class="ruby-constant">Type</span>.<span class="ruby-identifier">nil</span>)
  <span class="ruby-keyword">when</span> <span class="ruby-value">:putobject</span>, <span class="ruby-value">:duparray</span>
    <span class="ruby-identifier">obj</span>, = <span class="ruby-identifier">operands</span>
    <span class="ruby-identifier">env</span>, <span class="ruby-identifier">ty</span> = <span class="ruby-identifier">localize_type</span>(<span class="ruby-constant">Type</span>.<span class="ruby-identifier">guess_literal_type</span>(<span class="ruby-identifier">obj</span>), <span class="ruby-identifier">env</span>, <span class="ruby-identifier">ep</span>)
    <span class="ruby-identifier">env</span> = <span class="ruby-identifier">env</span>.<span class="ruby-identifier">push</span>(<span class="ruby-identifier">ty</span>)
  <span class="ruby-keyword">when</span> <span class="ruby-value">:putstring</span>
    <span class="ruby-identifier">str</span>, = <span class="ruby-identifier">operands</span>
    <span class="ruby-identifier">ty</span> = <span class="ruby-constant">Type</span><span class="ruby-operator">::</span><span class="ruby-constant">Literal</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">str</span>, <span class="ruby-constant">Type</span><span class="ruby-operator">::</span><span class="ruby-constant">Instance</span>.<span class="ruby-identifier">new</span>(<span class="ruby-constant">Type</span><span class="ruby-operator">::</span><span class="ruby-constant">Builtin</span>[<span class="ruby-value">:str</span>]))
    <span class="ruby-identifier">env</span> = <span class="ruby-identifier">env</span>.<span class="ruby-identifier">push</span>(<span class="ruby-identifier">ty</span>)
  <span class="ruby-keyword">when</span> <span class="ruby-value">:putself</span>
    <span class="ruby-identifier">ty</span> = <span class="ruby-identifier">env</span>.<span class="ruby-identifier">static_env</span>.<span class="ruby-identifier">recv_ty</span>
    <span class="ruby-keyword">if</span> <span class="ruby-identifier">ty</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Type</span><span class="ruby-operator">::</span><span class="ruby-constant">Instance</span>)
      <span class="ruby-identifier">klass</span> = <span class="ruby-identifier">ty</span>.<span class="ruby-identifier">klass</span>
      <span class="ruby-keyword">if</span> <span class="ruby-identifier">klass</span>.<span class="ruby-identifier">type_params</span>.<span class="ruby-identifier">size</span> <span class="ruby-operator">&gt;=</span> <span class="ruby-value">1</span>
        <span class="ruby-identifier">ty</span> = <span class="ruby-constant">Type</span><span class="ruby-operator">::</span><span class="ruby-constant">ContainerType</span>.<span class="ruby-identifier">create_empty_instance</span>(<span class="ruby-identifier">klass</span>)
        <span class="ruby-identifier">env</span>, <span class="ruby-identifier">ty</span> = <span class="ruby-identifier">localize_type</span>(<span class="ruby-identifier">ty</span>, <span class="ruby-identifier">env</span>, <span class="ruby-identifier">ep</span>, <span class="ruby-constant">AllocationSite</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">ep</span>))
      <span class="ruby-keyword">else</span>
        <span class="ruby-identifier">ty</span> = <span class="ruby-constant">Type</span><span class="ruby-operator">::</span><span class="ruby-constant">Instance</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">klass</span>)
      <span class="ruby-keyword">end</span>
      <span class="ruby-identifier">env</span>, <span class="ruby-identifier">ty</span> = <span class="ruby-identifier">localize_type</span>(<span class="ruby-identifier">ty</span>, <span class="ruby-identifier">env</span>, <span class="ruby-identifier">ep</span>)
    <span class="ruby-keyword">end</span>
    <span class="ruby-identifier">env</span> = <span class="ruby-identifier">env</span>.<span class="ruby-identifier">push</span>(<span class="ruby-identifier">ty</span>)
  <span class="ruby-keyword">when</span> <span class="ruby-value">:newarray</span>, <span class="ruby-value">:newarraykwsplat</span>
    <span class="ruby-identifier">len</span>, = <span class="ruby-identifier">operands</span>
    <span class="ruby-identifier">env</span>, <span class="ruby-identifier">elems</span> = <span class="ruby-identifier">env</span>.<span class="ruby-identifier">pop</span>(<span class="ruby-identifier">len</span>)
    <span class="ruby-identifier">ty</span> = <span class="ruby-constant">Type</span><span class="ruby-operator">::</span><span class="ruby-constant">Array</span>.<span class="ruby-identifier">new</span>(<span class="ruby-constant">Type</span><span class="ruby-operator">::</span><span class="ruby-constant">Array</span><span class="ruby-operator">::</span><span class="ruby-constant">Elements</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">elems</span>), <span class="ruby-constant">Type</span><span class="ruby-operator">::</span><span class="ruby-constant">Instance</span>.<span class="ruby-identifier">new</span>(<span class="ruby-constant">Type</span><span class="ruby-operator">::</span><span class="ruby-constant">Builtin</span>[<span class="ruby-value">:ary</span>]))
    <span class="ruby-identifier">env</span>, <span class="ruby-identifier">ty</span> = <span class="ruby-identifier">localize_type</span>(<span class="ruby-identifier">ty</span>, <span class="ruby-identifier">env</span>, <span class="ruby-identifier">ep</span>)
    <span class="ruby-identifier">env</span> = <span class="ruby-identifier">env</span>.<span class="ruby-identifier">push</span>(<span class="ruby-identifier">ty</span>)
  <span class="ruby-keyword">when</span> <span class="ruby-value">:newhash</span>
    <span class="ruby-identifier">num</span>, = <span class="ruby-identifier">operands</span>
    <span class="ruby-identifier">env</span>, <span class="ruby-identifier">tys</span> = <span class="ruby-identifier">env</span>.<span class="ruby-identifier">pop</span>(<span class="ruby-identifier">num</span>)

    <span class="ruby-identifier">ty</span> = <span class="ruby-constant">Type</span>.<span class="ruby-identifier">gen_hash</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">h</span><span class="ruby-operator">|</span>
      <span class="ruby-identifier">tys</span>.<span class="ruby-identifier">each_slice</span>(<span class="ruby-value">2</span>) <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">k_ty</span>, <span class="ruby-identifier">v_ty</span><span class="ruby-operator">|</span>
        <span class="ruby-identifier">k_ty</span> = <span class="ruby-identifier">globalize_type</span>(<span class="ruby-identifier">k_ty</span>, <span class="ruby-identifier">env</span>, <span class="ruby-identifier">ep</span>)
        <span class="ruby-identifier">h</span>[<span class="ruby-identifier">k_ty</span>] = <span class="ruby-identifier">v_ty</span>
      <span class="ruby-keyword">end</span>
    <span class="ruby-keyword">end</span>

    <span class="ruby-identifier">env</span>, <span class="ruby-identifier">ty</span> = <span class="ruby-identifier">localize_type</span>(<span class="ruby-identifier">ty</span>, <span class="ruby-identifier">env</span>, <span class="ruby-identifier">ep</span>)
    <span class="ruby-identifier">env</span> = <span class="ruby-identifier">env</span>.<span class="ruby-identifier">push</span>(<span class="ruby-identifier">ty</span>)
  <span class="ruby-keyword">when</span> <span class="ruby-value">:newhashfromarray</span>
    <span class="ruby-identifier">raise</span> <span class="ruby-constant">NotImplementedError</span>, <span class="ruby-string">&quot;newhashfromarray&quot;</span>
  <span class="ruby-keyword">when</span> <span class="ruby-value">:newrange</span>
    <span class="ruby-identifier">env</span>, <span class="ruby-identifier">tys</span> = <span class="ruby-identifier">env</span>.<span class="ruby-identifier">pop</span>(<span class="ruby-value">2</span>)
    <span class="ruby-comment"># XXX: need generics</span>
    <span class="ruby-identifier">env</span> = <span class="ruby-identifier">env</span>.<span class="ruby-identifier">push</span>(<span class="ruby-constant">Type</span><span class="ruby-operator">::</span><span class="ruby-constant">Instance</span>.<span class="ruby-identifier">new</span>(<span class="ruby-constant">Type</span><span class="ruby-operator">::</span><span class="ruby-constant">Builtin</span>[<span class="ruby-value">:range</span>]))

  <span class="ruby-keyword">when</span> <span class="ruby-value">:concatstrings</span>
    <span class="ruby-identifier">num</span>, = <span class="ruby-identifier">operands</span>
    <span class="ruby-identifier">env</span>, = <span class="ruby-identifier">env</span>.<span class="ruby-identifier">pop</span>(<span class="ruby-identifier">num</span>)
    <span class="ruby-identifier">env</span> = <span class="ruby-identifier">env</span>.<span class="ruby-identifier">push</span>(<span class="ruby-constant">Type</span><span class="ruby-operator">::</span><span class="ruby-constant">Instance</span>.<span class="ruby-identifier">new</span>(<span class="ruby-constant">Type</span><span class="ruby-operator">::</span><span class="ruby-constant">Builtin</span>[<span class="ruby-value">:str</span>]))
  <span class="ruby-keyword">when</span> <span class="ruby-value">:tostring</span>, <span class="ruby-value">:anytostring</span>
    <span class="ruby-identifier">env</span>, (<span class="ruby-identifier">_ty1</span>, <span class="ruby-identifier">_ty2</span>,) = <span class="ruby-identifier">env</span>.<span class="ruby-identifier">pop</span>(<span class="ruby-value">2</span>)
    <span class="ruby-identifier">env</span> = <span class="ruby-identifier">env</span>.<span class="ruby-identifier">push</span>(<span class="ruby-constant">Type</span><span class="ruby-operator">::</span><span class="ruby-constant">Instance</span>.<span class="ruby-identifier">new</span>(<span class="ruby-constant">Type</span><span class="ruby-operator">::</span><span class="ruby-constant">Builtin</span>[<span class="ruby-value">:str</span>]))
  <span class="ruby-keyword">when</span> <span class="ruby-value">:objtostring</span>
    <span class="ruby-identifier">env</span>, (<span class="ruby-identifier">_ty1</span>,) = <span class="ruby-identifier">env</span>.<span class="ruby-identifier">pop</span>(<span class="ruby-value">1</span>)
    <span class="ruby-identifier">env</span> = <span class="ruby-identifier">env</span>.<span class="ruby-identifier">push</span>(<span class="ruby-constant">Type</span><span class="ruby-operator">::</span><span class="ruby-constant">Instance</span>.<span class="ruby-identifier">new</span>(<span class="ruby-constant">Type</span><span class="ruby-operator">::</span><span class="ruby-constant">Builtin</span>[<span class="ruby-value">:str</span>]))
  <span class="ruby-keyword">when</span> <span class="ruby-value">:freezestring</span>
    <span class="ruby-comment"># do nothing</span>
  <span class="ruby-keyword">when</span> <span class="ruby-value">:toregexp</span>
    <span class="ruby-identifier">_regexp_opt</span>, <span class="ruby-identifier">str_count</span> = <span class="ruby-identifier">operands</span>
    <span class="ruby-identifier">env</span>, <span class="ruby-identifier">tys</span> = <span class="ruby-identifier">env</span>.<span class="ruby-identifier">pop</span>(<span class="ruby-identifier">str_count</span>)
    <span class="ruby-comment"># TODO: check if tys are all strings?</span>
    <span class="ruby-identifier">env</span> = <span class="ruby-identifier">env</span>.<span class="ruby-identifier">push</span>(<span class="ruby-constant">Type</span><span class="ruby-operator">::</span><span class="ruby-constant">Instance</span>.<span class="ruby-identifier">new</span>(<span class="ruby-constant">Type</span><span class="ruby-operator">::</span><span class="ruby-constant">Builtin</span>[<span class="ruby-value">:regexp</span>]))
  <span class="ruby-keyword">when</span> <span class="ruby-value">:intern</span>
    <span class="ruby-identifier">env</span>, (<span class="ruby-identifier">ty</span>,) = <span class="ruby-identifier">env</span>.<span class="ruby-identifier">pop</span>(<span class="ruby-value">1</span>)
    <span class="ruby-comment"># XXX check if ty is String</span>
    <span class="ruby-identifier">env</span> = <span class="ruby-identifier">env</span>.<span class="ruby-identifier">push</span>(<span class="ruby-constant">Type</span><span class="ruby-operator">::</span><span class="ruby-constant">Instance</span>.<span class="ruby-identifier">new</span>(<span class="ruby-constant">Type</span><span class="ruby-operator">::</span><span class="ruby-constant">Builtin</span>[<span class="ruby-value">:sym</span>]))

  <span class="ruby-keyword">when</span> <span class="ruby-value">:definemethod</span>
    <span class="ruby-identifier">mid</span>, <span class="ruby-identifier">iseq</span> = <span class="ruby-identifier">operands</span>
    <span class="ruby-identifier">do_define_iseq_method</span>(<span class="ruby-identifier">ep</span>, <span class="ruby-identifier">env</span>, <span class="ruby-identifier">mid</span>, <span class="ruby-identifier">iseq</span>, <span class="ruby-keyword">nil</span>)

  <span class="ruby-keyword">when</span> <span class="ruby-value">:definesmethod</span>
    <span class="ruby-identifier">mid</span>, <span class="ruby-identifier">iseq</span> = <span class="ruby-identifier">operands</span>
    <span class="ruby-identifier">env</span>, (<span class="ruby-identifier">recv</span>,) = <span class="ruby-identifier">env</span>.<span class="ruby-identifier">pop</span>(<span class="ruby-value">1</span>)
    <span class="ruby-identifier">cref</span> = <span class="ruby-identifier">ep</span>.<span class="ruby-identifier">ctx</span>.<span class="ruby-identifier">cref</span>
    <span class="ruby-identifier">recv</span>.<span class="ruby-identifier">each_child</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">recv</span><span class="ruby-operator">|</span>
      <span class="ruby-keyword">if</span> <span class="ruby-identifier">recv</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Type</span><span class="ruby-operator">::</span><span class="ruby-constant">Class</span>)
        <span class="ruby-identifier">typed_mdef</span> = <span class="ruby-identifier">check_typed_method</span>(<span class="ruby-identifier">recv</span>, <span class="ruby-identifier">mid</span>, <span class="ruby-keyword">true</span>)
        <span class="ruby-keyword">if</span> <span class="ruby-identifier">typed_mdef</span>
          <span class="ruby-identifier">mdef</span> = <span class="ruby-constant">ISeqMethodDef</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">iseq</span>, <span class="ruby-identifier">cref</span>, <span class="ruby-keyword">nil</span>, <span class="ruby-identifier">env</span>.<span class="ruby-identifier">static_env</span>.<span class="ruby-identifier">pub_meth</span>)
          <span class="ruby-identifier">typed_mdef</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">typed_mdef</span><span class="ruby-operator">|</span>
            <span class="ruby-identifier">typed_mdef</span>.<span class="ruby-identifier">do_match_iseq_mdef</span>(<span class="ruby-identifier">mdef</span>, <span class="ruby-identifier">recv</span>, <span class="ruby-identifier">mid</span>, <span class="ruby-identifier">env</span>, <span class="ruby-identifier">ep</span>, <span class="ruby-keyword">self</span>)
          <span class="ruby-keyword">end</span>
        <span class="ruby-keyword">else</span>
          <span class="ruby-identifier">meth</span> = <span class="ruby-identifier">add_singleton_iseq_method</span>(<span class="ruby-identifier">recv</span>, <span class="ruby-identifier">mid</span>, <span class="ruby-identifier">iseq</span>, <span class="ruby-identifier">cref</span>, <span class="ruby-keyword">nil</span>, <span class="ruby-identifier">env</span>.<span class="ruby-identifier">static_env</span>.<span class="ruby-identifier">pub_meth</span>)
        <span class="ruby-keyword">end</span>

        <span class="ruby-identifier">pend_method_execution</span>(<span class="ruby-identifier">iseq</span>, <span class="ruby-identifier">meth</span>, <span class="ruby-identifier">recv</span>, <span class="ruby-identifier">mid</span>, <span class="ruby-identifier">ep</span>.<span class="ruby-identifier">ctx</span>.<span class="ruby-identifier">cref</span>, <span class="ruby-keyword">nil</span>)
      <span class="ruby-keyword">else</span>
        <span class="ruby-identifier">recv</span> = <span class="ruby-constant">Type</span>.<span class="ruby-identifier">any</span> <span class="ruby-comment"># XXX: what to do?</span>
      <span class="ruby-keyword">end</span>
    <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">when</span> <span class="ruby-value">:defineclass</span>
    <span class="ruby-identifier">id</span>, <span class="ruby-identifier">iseq</span>, <span class="ruby-identifier">flags</span> = <span class="ruby-identifier">operands</span>
    <span class="ruby-identifier">env</span>, (<span class="ruby-identifier">cbase</span>, <span class="ruby-identifier">superclass</span>) = <span class="ruby-identifier">env</span>.<span class="ruby-identifier">pop</span>(<span class="ruby-value">2</span>)
    <span class="ruby-keyword">case</span> <span class="ruby-identifier">flags</span> <span class="ruby-operator">&amp;</span> <span class="ruby-value">7</span>
    <span class="ruby-keyword">when</span> <span class="ruby-value">0</span>, <span class="ruby-value">2</span> <span class="ruby-comment"># CLASS / MODULE</span>
      <span class="ruby-identifier">type</span> = (<span class="ruby-identifier">flags</span> <span class="ruby-operator">&amp;</span> <span class="ruby-value">7</span>) <span class="ruby-operator">==</span> <span class="ruby-value">2</span> <span class="ruby-operator">?</span> <span class="ruby-value">:module</span> <span class="ruby-operator">:</span> <span class="ruby-value">:class</span>
      <span class="ruby-identifier">existing_klass</span>, = <span class="ruby-identifier">get_constant</span>(<span class="ruby-identifier">cbase</span>, <span class="ruby-identifier">id</span>) <span class="ruby-comment"># TODO: multiple return values</span>
      <span class="ruby-keyword">if</span> <span class="ruby-identifier">existing_klass</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Type</span><span class="ruby-operator">::</span><span class="ruby-constant">Class</span>)
        <span class="ruby-comment"># record re-opening location</span>
        <span class="ruby-ivar">@class_defs</span>[<span class="ruby-identifier">cbase</span>.<span class="ruby-identifier">idx</span>].<span class="ruby-identifier">add_class_open</span>(<span class="ruby-identifier">id</span>, <span class="ruby-identifier">ep</span>)
        <span class="ruby-identifier">klass</span> = <span class="ruby-identifier">existing_klass</span>
      <span class="ruby-keyword">else</span>
        <span class="ruby-keyword">if</span> <span class="ruby-identifier">existing_klass</span> <span class="ruby-operator">!=</span> <span class="ruby-constant">Type</span>.<span class="ruby-identifier">any</span>
          <span class="ruby-identifier">error</span>(<span class="ruby-identifier">ep</span>, <span class="ruby-node">&quot;the class \&quot;#{ id }\&quot; is #{ existing_klass.screen_name(self) }&quot;</span>)
        <span class="ruby-keyword">end</span>
        <span class="ruby-keyword">if</span> <span class="ruby-identifier">type</span> <span class="ruby-operator">==</span> <span class="ruby-value">:class</span>
          <span class="ruby-keyword">if</span> <span class="ruby-identifier">superclass</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Type</span><span class="ruby-operator">::</span><span class="ruby-constant">Class</span>)
            <span class="ruby-comment"># okay</span>
          <span class="ruby-keyword">elsif</span> <span class="ruby-identifier">superclass</span> <span class="ruby-operator">==</span> <span class="ruby-constant">Type</span>.<span class="ruby-identifier">any</span>
            <span class="ruby-identifier">warn</span>(<span class="ruby-identifier">ep</span>, <span class="ruby-string">&quot;superclass is any; Object is used instead&quot;</span>)
            <span class="ruby-identifier">superclass</span> = <span class="ruby-constant">Type</span><span class="ruby-operator">::</span><span class="ruby-constant">Builtin</span>[<span class="ruby-value">:obj</span>]
          <span class="ruby-keyword">elsif</span> <span class="ruby-identifier">superclass</span> <span class="ruby-operator">==</span> <span class="ruby-constant">Type</span>.<span class="ruby-identifier">nil</span>
            <span class="ruby-identifier">superclass</span> = <span class="ruby-constant">Type</span><span class="ruby-operator">::</span><span class="ruby-constant">Builtin</span>[<span class="ruby-value">:obj</span>]
          <span class="ruby-keyword">elsif</span> <span class="ruby-identifier">superclass</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Type</span><span class="ruby-operator">::</span><span class="ruby-constant">Instance</span>)
            <span class="ruby-identifier">warn</span>(<span class="ruby-identifier">ep</span>, <span class="ruby-string">&quot;superclass is an instance; Object is used instead&quot;</span>)
            <span class="ruby-identifier">superclass</span> = <span class="ruby-constant">Type</span><span class="ruby-operator">::</span><span class="ruby-constant">Builtin</span>[<span class="ruby-value">:obj</span>]
          <span class="ruby-keyword">else</span>
            <span class="ruby-identifier">warn</span>(<span class="ruby-identifier">ep</span>, <span class="ruby-string">&quot;superclass is not a class; Object is used instead&quot;</span>)
            <span class="ruby-identifier">superclass</span> = <span class="ruby-constant">Type</span><span class="ruby-operator">::</span><span class="ruby-constant">Builtin</span>[<span class="ruby-value">:obj</span>]
          <span class="ruby-keyword">end</span>
        <span class="ruby-keyword">else</span> <span class="ruby-comment"># module</span>
          <span class="ruby-identifier">superclass</span> = <span class="ruby-keyword">nil</span>
        <span class="ruby-keyword">end</span>
        <span class="ruby-keyword">if</span> <span class="ruby-identifier">cbase</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Type</span><span class="ruby-operator">::</span><span class="ruby-constant">Class</span>)
          <span class="ruby-identifier">klass</span> = <span class="ruby-identifier">new_class</span>(<span class="ruby-identifier">cbase</span>, <span class="ruby-identifier">id</span>, [], <span class="ruby-identifier">superclass</span>, <span class="ruby-identifier">ep</span>)
          <span class="ruby-keyword">if</span> <span class="ruby-identifier">superclass</span>
            <span class="ruby-identifier">add_superclass_type_args!</span>(<span class="ruby-identifier">klass</span>, <span class="ruby-identifier">superclass</span>.<span class="ruby-identifier">type_params</span>.<span class="ruby-identifier">map</span> { <span class="ruby-constant">Type</span>.<span class="ruby-identifier">any</span> })

            <span class="ruby-comment"># inherited hook</span>
            <span class="ruby-identifier">aargs</span> = <span class="ruby-constant">ActualArguments</span>.<span class="ruby-identifier">new</span>([<span class="ruby-identifier">klass</span>], <span class="ruby-keyword">nil</span>, {}, <span class="ruby-constant">Type</span>.<span class="ruby-identifier">nil</span>)
            <span class="ruby-identifier">do_send</span>(<span class="ruby-identifier">superclass</span>, <span class="ruby-value">:inherited</span>, <span class="ruby-identifier">aargs</span>, <span class="ruby-identifier">ep</span>, <span class="ruby-identifier">env</span>) {<span class="ruby-operator">|</span><span class="ruby-identifier">_ret_ty</span>, <span class="ruby-identifier">_ep</span><span class="ruby-operator">|</span> }
          <span class="ruby-keyword">end</span>
        <span class="ruby-keyword">else</span>
          <span class="ruby-identifier">klass</span> = <span class="ruby-constant">Type</span>.<span class="ruby-identifier">any</span>
        <span class="ruby-keyword">end</span>
      <span class="ruby-keyword">end</span>
      <span class="ruby-identifier">singleton</span> = <span class="ruby-keyword">false</span>
    <span class="ruby-keyword">when</span> <span class="ruby-value">1</span> <span class="ruby-comment"># SINGLETON_CLASS</span>
      <span class="ruby-identifier">singleton</span> = <span class="ruby-keyword">true</span>
      <span class="ruby-identifier">klass</span> = <span class="ruby-identifier">cbase</span>
      <span class="ruby-keyword">if</span> <span class="ruby-identifier">klass</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Type</span><span class="ruby-operator">::</span><span class="ruby-constant">Class</span>)
      <span class="ruby-keyword">elsif</span> <span class="ruby-identifier">klass</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Type</span><span class="ruby-operator">::</span><span class="ruby-constant">Any</span>)
      <span class="ruby-keyword">else</span>
        <span class="ruby-identifier">warn</span>(<span class="ruby-identifier">ep</span>, <span class="ruby-node">&quot;A singleton class is open for #{ klass.screen_name(self) }; handled as any&quot;</span>)
        <span class="ruby-identifier">klass</span> = <span class="ruby-constant">Type</span>.<span class="ruby-identifier">any</span>
      <span class="ruby-keyword">end</span>
    <span class="ruby-keyword">else</span>
      <span class="ruby-identifier">raise</span> <span class="ruby-constant">NotImplementedError</span>, <span class="ruby-node">&quot;unknown defineclass flag: #{ flags }&quot;</span>
    <span class="ruby-keyword">end</span>
    <span class="ruby-identifier">ncref</span> = <span class="ruby-identifier">ep</span>.<span class="ruby-identifier">ctx</span>.<span class="ruby-identifier">cref</span>.<span class="ruby-identifier">extend</span>(<span class="ruby-identifier">klass</span>, <span class="ruby-identifier">singleton</span>)
    <span class="ruby-identifier">recv</span> = <span class="ruby-identifier">singleton</span> <span class="ruby-operator">?</span> <span class="ruby-constant">Type</span>.<span class="ruby-identifier">any</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">klass</span>
    <span class="ruby-identifier">blk</span> = <span class="ruby-identifier">env</span>.<span class="ruby-identifier">static_env</span>.<span class="ruby-identifier">blk_ty</span>
    <span class="ruby-identifier">nctx</span> = <span class="ruby-constant">Context</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">iseq</span>, <span class="ruby-identifier">ncref</span>, <span class="ruby-keyword">nil</span>)
    <span class="ruby-identifier">nep</span> = <span class="ruby-constant">ExecutionPoint</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">nctx</span>, <span class="ruby-value">0</span>, <span class="ruby-keyword">nil</span>)
    <span class="ruby-identifier">locals</span> = [<span class="ruby-constant">Type</span>.<span class="ruby-identifier">nil</span>] <span class="ruby-operator">*</span> <span class="ruby-identifier">iseq</span>.<span class="ruby-identifier">locals</span>.<span class="ruby-identifier">size</span>
    <span class="ruby-identifier">nenv</span> = <span class="ruby-constant">Env</span>.<span class="ruby-identifier">new</span>(<span class="ruby-constant">StaticEnv</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">recv</span>, <span class="ruby-identifier">blk</span>, <span class="ruby-keyword">false</span>, <span class="ruby-keyword">true</span>), <span class="ruby-identifier">locals</span>, [], <span class="ruby-constant">Utils</span><span class="ruby-operator">::</span><span class="ruby-constant">HashWrapper</span>.<span class="ruby-identifier">new</span>({}))
    <span class="ruby-identifier">merge_env</span>(<span class="ruby-identifier">nep</span>, <span class="ruby-identifier">nenv</span>)
    <span class="ruby-identifier">add_callsite!</span>(<span class="ruby-identifier">nep</span>.<span class="ruby-identifier">ctx</span>, <span class="ruby-identifier">ep</span>, <span class="ruby-identifier">env</span>) <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">ret_ty</span>, <span class="ruby-identifier">ep</span>, <span class="ruby-identifier">env</span><span class="ruby-operator">|</span>
      <span class="ruby-identifier">nenv</span>, <span class="ruby-identifier">ret_ty</span> = <span class="ruby-identifier">localize_type</span>(<span class="ruby-identifier">ret_ty</span>, <span class="ruby-identifier">env</span>, <span class="ruby-identifier">ep</span>)
      <span class="ruby-identifier">nenv</span> = <span class="ruby-identifier">nenv</span>.<span class="ruby-identifier">push</span>(<span class="ruby-identifier">ret_ty</span>)
      <span class="ruby-identifier">merge_env</span>(<span class="ruby-identifier">ep</span>.<span class="ruby-identifier">next</span>, <span class="ruby-identifier">nenv</span>)
    <span class="ruby-keyword">end</span>
    <span class="ruby-keyword">return</span>
  <span class="ruby-keyword">when</span> <span class="ruby-value">:send</span>
    <span class="ruby-identifier">env</span>, <span class="ruby-identifier">recvs</span>, <span class="ruby-identifier">mid</span>, <span class="ruby-identifier">aargs</span> = <span class="ruby-identifier">setup_actual_arguments</span>(<span class="ruby-value">:method</span>, <span class="ruby-identifier">operands</span>, <span class="ruby-identifier">ep</span>, <span class="ruby-identifier">env</span>)
    <span class="ruby-identifier">recvs</span> = <span class="ruby-constant">Type</span>.<span class="ruby-identifier">any</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">recvs</span> <span class="ruby-operator">==</span> <span class="ruby-constant">Type</span>.<span class="ruby-identifier">bot</span>
    <span class="ruby-identifier">do_send</span>(<span class="ruby-identifier">recvs</span>, <span class="ruby-identifier">mid</span>, <span class="ruby-identifier">aargs</span>, <span class="ruby-identifier">ep</span>, <span class="ruby-identifier">env</span>) <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">ret_ty</span>, <span class="ruby-identifier">ep</span>, <span class="ruby-identifier">env</span><span class="ruby-operator">|</span>
      <span class="ruby-identifier">nenv</span>, <span class="ruby-identifier">ret_ty</span>, = <span class="ruby-identifier">localize_type</span>(<span class="ruby-identifier">ret_ty</span>, <span class="ruby-identifier">env</span>, <span class="ruby-identifier">ep</span>)
      <span class="ruby-identifier">nenv</span> = <span class="ruby-identifier">nenv</span>.<span class="ruby-identifier">push</span>(<span class="ruby-identifier">ret_ty</span>)
      <span class="ruby-identifier">merge_env</span>(<span class="ruby-identifier">ep</span>.<span class="ruby-identifier">next</span>, <span class="ruby-identifier">nenv</span>)
    <span class="ruby-keyword">end</span>
    <span class="ruby-keyword">return</span>
  <span class="ruby-keyword">when</span> <span class="ruby-value">:recv_getlocal_send_branch</span>
    <span class="ruby-identifier">getlocal_operands</span>, <span class="ruby-identifier">send_operands</span>, <span class="ruby-identifier">branch_operands</span> = <span class="ruby-identifier">operands</span>
    <span class="ruby-identifier">env</span>, <span class="ruby-identifier">recvs</span>, <span class="ruby-identifier">mid</span>, <span class="ruby-identifier">aargs</span> = <span class="ruby-identifier">setup_actual_arguments</span>(<span class="ruby-value">:method</span>, <span class="ruby-identifier">send_operands</span>, <span class="ruby-identifier">ep</span>, <span class="ruby-identifier">env</span>)
    <span class="ruby-identifier">recvs</span> = <span class="ruby-constant">Type</span>.<span class="ruby-identifier">any</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">recvs</span> <span class="ruby-operator">==</span> <span class="ruby-constant">Type</span>.<span class="ruby-identifier">bot</span>
    <span class="ruby-identifier">recvs</span>.<span class="ruby-identifier">each_child</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">recv</span><span class="ruby-operator">|</span>
      <span class="ruby-identifier">do_send</span>(<span class="ruby-identifier">recv</span>, <span class="ruby-identifier">mid</span>, <span class="ruby-identifier">aargs</span>, <span class="ruby-identifier">ep</span>, <span class="ruby-identifier">env</span>) <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">ret_ty</span>, <span class="ruby-identifier">ep</span>, <span class="ruby-identifier">env</span><span class="ruby-operator">|</span>
        <span class="ruby-identifier">env</span>, <span class="ruby-identifier">ret_ty</span>, = <span class="ruby-identifier">localize_type</span>(<span class="ruby-identifier">ret_ty</span>, <span class="ruby-identifier">env</span>, <span class="ruby-identifier">ep</span>)

        <span class="ruby-identifier">branchtype</span>, <span class="ruby-identifier">target</span>, = <span class="ruby-identifier">branch_operands</span>
        <span class="ruby-comment"># branchtype: :if or :unless or :nil</span>
        <span class="ruby-identifier">ep_then</span> = <span class="ruby-identifier">ep</span>.<span class="ruby-identifier">next</span>
        <span class="ruby-identifier">ep_else</span> = <span class="ruby-identifier">ep</span>.<span class="ruby-identifier">jump</span>(<span class="ruby-identifier">target</span>)

        <span class="ruby-identifier">var_idx</span>, <span class="ruby-identifier">_scope_idx</span>, <span class="ruby-identifier">_escaped</span> = <span class="ruby-identifier">getlocal_operands</span>
        <span class="ruby-identifier">flow_env</span> = <span class="ruby-identifier">env</span>.<span class="ruby-identifier">local_update</span>(<span class="ruby-operator">-</span><span class="ruby-identifier">var_idx</span><span class="ruby-value">+2</span>, <span class="ruby-identifier">recv</span>)

        <span class="ruby-keyword">case</span> <span class="ruby-identifier">ret_ty</span>
        <span class="ruby-keyword">when</span> <span class="ruby-constant">Type</span><span class="ruby-operator">::</span><span class="ruby-constant">Instance</span>.<span class="ruby-identifier">new</span>(<span class="ruby-constant">Type</span><span class="ruby-operator">::</span><span class="ruby-constant">Builtin</span>[<span class="ruby-value">:true</span>])
          <span class="ruby-identifier">merge_env</span>(<span class="ruby-identifier">branchtype</span> <span class="ruby-operator">==</span> <span class="ruby-value">:if</span> <span class="ruby-operator">?</span> <span class="ruby-identifier">ep_else</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">ep_then</span>, <span class="ruby-identifier">flow_env</span>)
        <span class="ruby-keyword">when</span> <span class="ruby-constant">Type</span><span class="ruby-operator">::</span><span class="ruby-constant">Instance</span>.<span class="ruby-identifier">new</span>(<span class="ruby-constant">Type</span><span class="ruby-operator">::</span><span class="ruby-constant">Builtin</span>[<span class="ruby-value">:false</span>])
          <span class="ruby-identifier">merge_env</span>(<span class="ruby-identifier">branchtype</span> <span class="ruby-operator">==</span> <span class="ruby-value">:if</span> <span class="ruby-operator">?</span> <span class="ruby-identifier">ep_then</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">ep_else</span>, <span class="ruby-identifier">flow_env</span>)
        <span class="ruby-keyword">else</span>
          <span class="ruby-identifier">merge_env</span>(<span class="ruby-identifier">ep_then</span>, <span class="ruby-identifier">env</span>)
          <span class="ruby-identifier">merge_env</span>(<span class="ruby-identifier">ep_else</span>, <span class="ruby-identifier">env</span>)
        <span class="ruby-keyword">end</span>
      <span class="ruby-keyword">end</span>
    <span class="ruby-keyword">end</span>
    <span class="ruby-keyword">return</span>
  <span class="ruby-keyword">when</span> <span class="ruby-value">:arg_getlocal_send_branch</span>
    <span class="ruby-identifier">getlocal_operands</span>, <span class="ruby-identifier">send_operands</span>, <span class="ruby-identifier">branch_operands</span> = <span class="ruby-identifier">operands</span>
    <span class="ruby-identifier">env</span>, <span class="ruby-identifier">recvs</span>, <span class="ruby-identifier">mid</span>, <span class="ruby-identifier">aargs</span> = <span class="ruby-identifier">setup_actual_arguments</span>(<span class="ruby-value">:method</span>, <span class="ruby-identifier">send_operands</span>, <span class="ruby-identifier">ep</span>, <span class="ruby-identifier">env</span>)
    <span class="ruby-identifier">raise</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">aargs</span>.<span class="ruby-identifier">lead_tys</span>.<span class="ruby-identifier">size</span> <span class="ruby-operator">!=</span> <span class="ruby-value">1</span>
    <span class="ruby-identifier">aarg</span> = <span class="ruby-identifier">aargs</span>.<span class="ruby-identifier">lead_tys</span>[<span class="ruby-value">0</span>]
    <span class="ruby-identifier">aarg</span> = <span class="ruby-constant">Type</span>.<span class="ruby-identifier">any</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">aarg</span> <span class="ruby-operator">==</span> <span class="ruby-constant">Type</span>.<span class="ruby-identifier">bot</span>
    <span class="ruby-identifier">recvs</span>.<span class="ruby-identifier">each_child</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">recv</span><span class="ruby-operator">|</span>
      <span class="ruby-identifier">aarg</span>.<span class="ruby-identifier">each_child</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">aarg</span><span class="ruby-operator">|</span>
        <span class="ruby-identifier">aargs_tmp</span> = <span class="ruby-constant">ActualArguments</span>.<span class="ruby-identifier">new</span>([<span class="ruby-identifier">aarg</span>], <span class="ruby-keyword">nil</span>, {}, <span class="ruby-identifier">aargs</span>.<span class="ruby-identifier">blk_ty</span>)
        <span class="ruby-identifier">do_send</span>(<span class="ruby-identifier">recv</span>, <span class="ruby-identifier">mid</span>, <span class="ruby-identifier">aargs_tmp</span>, <span class="ruby-identifier">ep</span>, <span class="ruby-identifier">env</span>) <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">ret_ty</span>, <span class="ruby-identifier">ep</span>, <span class="ruby-identifier">env</span><span class="ruby-operator">|</span>
          <span class="ruby-identifier">env</span>, <span class="ruby-identifier">ret_ty</span>, = <span class="ruby-identifier">localize_type</span>(<span class="ruby-identifier">ret_ty</span>, <span class="ruby-identifier">env</span>, <span class="ruby-identifier">ep</span>)

          <span class="ruby-identifier">branchtype</span>, <span class="ruby-identifier">target</span>, = <span class="ruby-identifier">branch_operands</span>
          <span class="ruby-comment"># branchtype: :if or :unless or :nil</span>
          <span class="ruby-identifier">ep_then</span> = <span class="ruby-identifier">ep</span>.<span class="ruby-identifier">next</span>
          <span class="ruby-identifier">ep_else</span> = <span class="ruby-identifier">ep</span>.<span class="ruby-identifier">jump</span>(<span class="ruby-identifier">target</span>)

          <span class="ruby-identifier">var_idx</span>, <span class="ruby-identifier">_scope_idx</span>, <span class="ruby-identifier">_escaped</span> = <span class="ruby-identifier">getlocal_operands</span>
          <span class="ruby-identifier">flow_env</span> = <span class="ruby-identifier">env</span>.<span class="ruby-identifier">local_update</span>(<span class="ruby-operator">-</span><span class="ruby-identifier">var_idx</span><span class="ruby-value">+2</span>, <span class="ruby-identifier">aarg</span>)

          <span class="ruby-keyword">case</span> <span class="ruby-identifier">ret_ty</span>
          <span class="ruby-keyword">when</span> <span class="ruby-constant">Type</span><span class="ruby-operator">::</span><span class="ruby-constant">Instance</span>.<span class="ruby-identifier">new</span>(<span class="ruby-constant">Type</span><span class="ruby-operator">::</span><span class="ruby-constant">Builtin</span>[<span class="ruby-value">:true</span>])
            <span class="ruby-identifier">merge_env</span>(<span class="ruby-identifier">branchtype</span> <span class="ruby-operator">==</span> <span class="ruby-value">:if</span> <span class="ruby-operator">?</span> <span class="ruby-identifier">ep_else</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">ep_then</span>, <span class="ruby-identifier">flow_env</span>)
          <span class="ruby-keyword">when</span> <span class="ruby-constant">Type</span><span class="ruby-operator">::</span><span class="ruby-constant">Instance</span>.<span class="ruby-identifier">new</span>(<span class="ruby-constant">Type</span><span class="ruby-operator">::</span><span class="ruby-constant">Builtin</span>[<span class="ruby-value">:false</span>])
            <span class="ruby-identifier">merge_env</span>(<span class="ruby-identifier">branchtype</span> <span class="ruby-operator">==</span> <span class="ruby-value">:if</span> <span class="ruby-operator">?</span> <span class="ruby-identifier">ep_then</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">ep_else</span>, <span class="ruby-identifier">flow_env</span>)
          <span class="ruby-keyword">else</span>
            <span class="ruby-identifier">merge_env</span>(<span class="ruby-identifier">ep_then</span>, <span class="ruby-identifier">env</span>)
            <span class="ruby-identifier">merge_env</span>(<span class="ruby-identifier">ep_else</span>, <span class="ruby-identifier">env</span>)
          <span class="ruby-keyword">end</span>
        <span class="ruby-keyword">end</span>
      <span class="ruby-keyword">end</span>
    <span class="ruby-keyword">end</span>
    <span class="ruby-keyword">return</span>
  <span class="ruby-keyword">when</span> <span class="ruby-value">:send_branch</span>
    <span class="ruby-identifier">send_operands</span>, <span class="ruby-identifier">branch_operands</span> = <span class="ruby-identifier">operands</span>
    <span class="ruby-identifier">env</span>, <span class="ruby-identifier">recvs</span>, <span class="ruby-identifier">mid</span>, <span class="ruby-identifier">aargs</span> = <span class="ruby-identifier">setup_actual_arguments</span>(<span class="ruby-value">:method</span>, <span class="ruby-identifier">send_operands</span>, <span class="ruby-identifier">ep</span>, <span class="ruby-identifier">env</span>)
    <span class="ruby-identifier">recvs</span> = <span class="ruby-constant">Type</span>.<span class="ruby-identifier">any</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">recvs</span> <span class="ruby-operator">==</span> <span class="ruby-constant">Type</span>.<span class="ruby-identifier">bot</span>
    <span class="ruby-identifier">do_send</span>(<span class="ruby-identifier">recvs</span>, <span class="ruby-identifier">mid</span>, <span class="ruby-identifier">aargs</span>, <span class="ruby-identifier">ep</span>, <span class="ruby-identifier">env</span>) <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">ret_ty</span>, <span class="ruby-identifier">ep</span>, <span class="ruby-identifier">env</span><span class="ruby-operator">|</span>
      <span class="ruby-identifier">env</span>, <span class="ruby-identifier">ret_ty</span>, = <span class="ruby-identifier">localize_type</span>(<span class="ruby-identifier">ret_ty</span>, <span class="ruby-identifier">env</span>, <span class="ruby-identifier">ep</span>)

      <span class="ruby-identifier">branchtype</span>, <span class="ruby-identifier">target</span>, = <span class="ruby-identifier">branch_operands</span>
      <span class="ruby-comment"># branchtype: :if or :unless or :nil</span>
      <span class="ruby-identifier">ep_then</span> = <span class="ruby-identifier">ep</span>.<span class="ruby-identifier">next</span>
      <span class="ruby-identifier">ep_else</span> = <span class="ruby-identifier">ep</span>.<span class="ruby-identifier">jump</span>(<span class="ruby-identifier">target</span>)

      <span class="ruby-keyword">case</span> <span class="ruby-identifier">ret_ty</span>
      <span class="ruby-keyword">when</span> <span class="ruby-constant">Type</span><span class="ruby-operator">::</span><span class="ruby-constant">Instance</span>.<span class="ruby-identifier">new</span>(<span class="ruby-constant">Type</span><span class="ruby-operator">::</span><span class="ruby-constant">Builtin</span>[<span class="ruby-value">:true</span>])
        <span class="ruby-identifier">merge_env</span>(<span class="ruby-identifier">branchtype</span> <span class="ruby-operator">==</span> <span class="ruby-value">:if</span> <span class="ruby-operator">?</span> <span class="ruby-identifier">ep_else</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">ep_then</span>, <span class="ruby-identifier">env</span>)
      <span class="ruby-keyword">when</span> <span class="ruby-constant">Type</span><span class="ruby-operator">::</span><span class="ruby-constant">Instance</span>.<span class="ruby-identifier">new</span>(<span class="ruby-constant">Type</span><span class="ruby-operator">::</span><span class="ruby-constant">Builtin</span>[<span class="ruby-value">:false</span>])
        <span class="ruby-identifier">merge_env</span>(<span class="ruby-identifier">branchtype</span> <span class="ruby-operator">==</span> <span class="ruby-value">:if</span> <span class="ruby-operator">?</span> <span class="ruby-identifier">ep_then</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">ep_else</span>, <span class="ruby-identifier">env</span>)
      <span class="ruby-keyword">else</span>
        <span class="ruby-identifier">merge_env</span>(<span class="ruby-identifier">ep_then</span>, <span class="ruby-identifier">env</span>)
        <span class="ruby-identifier">merge_env</span>(<span class="ruby-identifier">ep_else</span>, <span class="ruby-identifier">env</span>)
      <span class="ruby-keyword">end</span>
    <span class="ruby-keyword">end</span>
    <span class="ruby-keyword">return</span>
  <span class="ruby-keyword">when</span> <span class="ruby-value">:invokeblock</span>
    <span class="ruby-identifier">env</span>, <span class="ruby-identifier">recvs</span>, <span class="ruby-identifier">mid</span>, <span class="ruby-identifier">aargs</span> = <span class="ruby-identifier">setup_actual_arguments</span>(<span class="ruby-value">:block</span>, <span class="ruby-identifier">operands</span>, <span class="ruby-identifier">ep</span>, <span class="ruby-identifier">env</span>)
    <span class="ruby-identifier">blk</span> = <span class="ruby-identifier">env</span>.<span class="ruby-identifier">static_env</span>.<span class="ruby-identifier">blk_ty</span>
    <span class="ruby-keyword">case</span>
    <span class="ruby-keyword">when</span> <span class="ruby-identifier">blk</span> <span class="ruby-operator">==</span> <span class="ruby-constant">Type</span>.<span class="ruby-identifier">nil</span>
      <span class="ruby-identifier">env</span> = <span class="ruby-identifier">env</span>.<span class="ruby-identifier">push</span>(<span class="ruby-constant">Type</span>.<span class="ruby-identifier">any</span>)
    <span class="ruby-keyword">when</span> <span class="ruby-identifier">blk</span> <span class="ruby-operator">==</span> <span class="ruby-constant">Type</span>.<span class="ruby-identifier">any</span>
      <span class="ruby-comment">#warn(ep, &quot;block is any&quot;)</span>
      <span class="ruby-identifier">env</span> = <span class="ruby-identifier">env</span>.<span class="ruby-identifier">push</span>(<span class="ruby-constant">Type</span>.<span class="ruby-identifier">any</span>)
    <span class="ruby-keyword">else</span> <span class="ruby-comment"># Proc</span>
      <span class="ruby-identifier">do_invoke_block</span>(<span class="ruby-identifier">blk</span>, <span class="ruby-identifier">aargs</span>, <span class="ruby-identifier">ep</span>, <span class="ruby-identifier">env</span>) <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">ret_ty</span>, <span class="ruby-identifier">ep</span>, <span class="ruby-identifier">env</span><span class="ruby-operator">|</span>
        <span class="ruby-identifier">nenv</span>, <span class="ruby-identifier">ret_ty</span>, = <span class="ruby-identifier">localize_type</span>(<span class="ruby-identifier">ret_ty</span>, <span class="ruby-identifier">env</span>, <span class="ruby-identifier">ep</span>)
        <span class="ruby-identifier">nenv</span> = <span class="ruby-identifier">nenv</span>.<span class="ruby-identifier">push</span>(<span class="ruby-identifier">ret_ty</span>)
        <span class="ruby-identifier">merge_env</span>(<span class="ruby-identifier">ep</span>.<span class="ruby-identifier">next</span>, <span class="ruby-identifier">nenv</span>)
      <span class="ruby-keyword">end</span>
      <span class="ruby-keyword">return</span>
    <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">when</span> <span class="ruby-value">:invokesuper</span>
    <span class="ruby-identifier">env</span>, <span class="ruby-identifier">recv</span>, <span class="ruby-identifier">_</span>, <span class="ruby-identifier">aargs</span> = <span class="ruby-identifier">setup_actual_arguments</span>(<span class="ruby-value">:method</span>, <span class="ruby-identifier">operands</span>, <span class="ruby-identifier">ep</span>, <span class="ruby-identifier">env</span>)
    <span class="ruby-identifier">mid</span> = <span class="ruby-identifier">ep</span>.<span class="ruby-identifier">ctx</span>.<span class="ruby-identifier">mid</span>
    <span class="ruby-identifier">found</span> = <span class="ruby-keyword">false</span>
    <span class="ruby-identifier">recv</span>.<span class="ruby-identifier">each_child_global</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">recv</span><span class="ruby-operator">|</span>
      <span class="ruby-identifier">klass</span>, <span class="ruby-identifier">singleton</span> = <span class="ruby-identifier">recv</span>.<span class="ruby-identifier">method_dispatch_info</span>
      <span class="ruby-keyword">next</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">klass</span>
      <span class="ruby-identifier">get_all_super_methods</span>(<span class="ruby-identifier">klass</span>, <span class="ruby-identifier">singleton</span>, <span class="ruby-identifier">ep</span>.<span class="ruby-identifier">ctx</span>.<span class="ruby-identifier">cref</span>.<span class="ruby-identifier">klass</span>, <span class="ruby-identifier">ep</span>.<span class="ruby-identifier">ctx</span>.<span class="ruby-identifier">mid</span>) <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">meths</span>, <span class="ruby-identifier">klass</span><span class="ruby-operator">|</span>
        <span class="ruby-identifier">found</span> = <span class="ruby-keyword">true</span>
        <span class="ruby-identifier">meths</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">meth</span><span class="ruby-operator">|</span>
          <span class="ruby-comment"># XXX: this decomposition is really needed??</span>
          <span class="ruby-comment"># It calls `Object.new` with union receiver which causes an error, but</span>
          <span class="ruby-comment"># it may be a fault of builtin Object.new implementation.</span>
          <span class="ruby-identifier">meth</span>.<span class="ruby-identifier">do_send</span>(<span class="ruby-identifier">recv</span>, <span class="ruby-identifier">mid</span>, <span class="ruby-identifier">aargs</span>, <span class="ruby-identifier">ep</span>, <span class="ruby-identifier">env</span>, <span class="ruby-keyword">self</span>) <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">ret_ty</span>, <span class="ruby-identifier">ep</span>, <span class="ruby-identifier">env</span><span class="ruby-operator">|</span>
            <span class="ruby-identifier">nenv</span>, <span class="ruby-identifier">ret_ty</span>, = <span class="ruby-identifier">localize_type</span>(<span class="ruby-identifier">ret_ty</span>, <span class="ruby-identifier">env</span>, <span class="ruby-identifier">ep</span>)
            <span class="ruby-identifier">nenv</span> = <span class="ruby-identifier">nenv</span>.<span class="ruby-identifier">push</span>(<span class="ruby-identifier">ret_ty</span>)
            <span class="ruby-identifier">merge_env</span>(<span class="ruby-identifier">ep</span>.<span class="ruby-identifier">next</span>, <span class="ruby-identifier">nenv</span>)
          <span class="ruby-keyword">end</span>
        <span class="ruby-keyword">end</span>
      <span class="ruby-keyword">end</span>
    <span class="ruby-keyword">end</span>
    <span class="ruby-keyword">return</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">found</span>
    <span class="ruby-identifier">error</span>(<span class="ruby-identifier">ep</span>, <span class="ruby-node">&quot;no superclass method: #{ env.static_env.recv_ty.screen_name(self) }##{ mid }&quot;</span>)
    <span class="ruby-identifier">env</span> = <span class="ruby-identifier">env</span>.<span class="ruby-identifier">push</span>(<span class="ruby-constant">Type</span>.<span class="ruby-identifier">any</span>)
  <span class="ruby-keyword">when</span> <span class="ruby-value">:invokebuiltin</span>
    <span class="ruby-identifier">raise</span> <span class="ruby-constant">NotImplementedError</span>
  <span class="ruby-keyword">when</span> <span class="ruby-value">:leave</span>
    <span class="ruby-keyword">if</span> <span class="ruby-identifier">env</span>.<span class="ruby-identifier">stack</span>.<span class="ruby-identifier">size</span> <span class="ruby-operator">!=</span> <span class="ruby-value">1</span>
      <span class="ruby-identifier">raise</span> <span class="ruby-node">&quot;stack inconsistency error: #{ env.stack.inspect }&quot;</span>
    <span class="ruby-keyword">end</span>
    <span class="ruby-identifier">env</span>, (<span class="ruby-identifier">ty</span>,) = <span class="ruby-identifier">env</span>.<span class="ruby-identifier">pop</span>(<span class="ruby-value">1</span>)
    <span class="ruby-identifier">ty</span> = <span class="ruby-identifier">globalize_type</span>(<span class="ruby-identifier">ty</span>, <span class="ruby-identifier">env</span>, <span class="ruby-identifier">ep</span>)
    <span class="ruby-identifier">add_return_value!</span>(<span class="ruby-identifier">ep</span>.<span class="ruby-identifier">ctx</span>, <span class="ruby-identifier">ty</span>)
    <span class="ruby-keyword">return</span>
  <span class="ruby-keyword">when</span> <span class="ruby-value">:throw</span>
    <span class="ruby-identifier">throwtype</span>, = <span class="ruby-identifier">operands</span>
    <span class="ruby-identifier">env</span>, (<span class="ruby-identifier">ty</span>,) = <span class="ruby-identifier">env</span>.<span class="ruby-identifier">pop</span>(<span class="ruby-value">1</span>)
    <span class="ruby-identifier">_no_escape</span> = <span class="ruby-operator">!</span><span class="ruby-operator">!</span>(<span class="ruby-identifier">throwtype</span> <span class="ruby-operator">&amp;</span> <span class="ruby-value">0x8000</span>)
    <span class="ruby-identifier">throwtype</span> = [<span class="ruby-value">:none</span>, <span class="ruby-value">:return</span>, <span class="ruby-value">:break</span>, <span class="ruby-value">:next</span>, <span class="ruby-value">:retry</span>, <span class="ruby-value">:redo</span>][<span class="ruby-identifier">throwtype</span> <span class="ruby-operator">&amp;</span> <span class="ruby-value">0xff</span>]
    <span class="ruby-keyword">case</span> <span class="ruby-identifier">throwtype</span>
    <span class="ruby-keyword">when</span> <span class="ruby-value">:none</span>

    <span class="ruby-keyword">when</span> <span class="ruby-value">:return</span>
      <span class="ruby-identifier">ty</span> = <span class="ruby-identifier">globalize_type</span>(<span class="ruby-identifier">ty</span>, <span class="ruby-identifier">env</span>, <span class="ruby-identifier">ep</span>)
      <span class="ruby-identifier">tmp_ep</span> = <span class="ruby-identifier">ep</span>
      <span class="ruby-identifier">tmp_ep</span> = <span class="ruby-identifier">tmp_ep</span>.<span class="ruby-identifier">outer</span> <span class="ruby-keyword">while</span> <span class="ruby-identifier">tmp_ep</span>.<span class="ruby-identifier">outer</span>
      <span class="ruby-identifier">add_return_value!</span>(<span class="ruby-identifier">tmp_ep</span>.<span class="ruby-identifier">ctx</span>, <span class="ruby-identifier">ty</span>)
      <span class="ruby-keyword">return</span>
    <span class="ruby-keyword">when</span> <span class="ruby-value">:break</span>
      <span class="ruby-identifier">tmp_ep</span> = <span class="ruby-identifier">ep</span>
      <span class="ruby-keyword">while</span> <span class="ruby-keyword">true</span>
        <span class="ruby-keyword">if</span> <span class="ruby-identifier">tmp_ep</span>.<span class="ruby-identifier">ctx</span>.<span class="ruby-identifier">iseq</span>.<span class="ruby-identifier">type</span> <span class="ruby-operator">==</span> <span class="ruby-value">:block</span>
          <span class="ruby-identifier">tmp_ep</span> = <span class="ruby-identifier">tmp_ep</span>.<span class="ruby-identifier">outer</span>
          <span class="ruby-identifier">nenv</span> = <span class="ruby-ivar">@return_envs</span>[<span class="ruby-identifier">tmp_ep</span>].<span class="ruby-identifier">push</span>(<span class="ruby-identifier">ty</span>)
          <span class="ruby-identifier">merge_env</span>(<span class="ruby-identifier">tmp_ep</span>.<span class="ruby-identifier">next</span>, <span class="ruby-identifier">nenv</span>)
          <span class="ruby-keyword">break</span>
        <span class="ruby-keyword">end</span>
        <span class="ruby-identifier">_type</span>, <span class="ruby-identifier">_iseq</span>, <span class="ruby-identifier">cont</span>, <span class="ruby-identifier">stack_depth</span> = <span class="ruby-identifier">tmp_ep</span>.<span class="ruby-identifier">ctx</span>.<span class="ruby-identifier">iseq</span>.<span class="ruby-identifier">catch_table</span>[<span class="ruby-identifier">tmp_ep</span>.<span class="ruby-identifier">pc</span>]&amp;.<span class="ruby-identifier">find</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">type</span>,<span class="ruby-operator">|</span> <span class="ruby-identifier">type</span> <span class="ruby-operator">==</span> <span class="ruby-value">:break</span> }
        <span class="ruby-keyword">if</span> <span class="ruby-identifier">cont</span>
          <span class="ruby-identifier">nenv</span> = <span class="ruby-ivar">@return_envs</span>[<span class="ruby-identifier">tmp_ep</span>] <span class="ruby-operator">||</span> <span class="ruby-identifier">env</span>
          <span class="ruby-identifier">nenv</span>, = <span class="ruby-identifier">nenv</span>.<span class="ruby-identifier">pop</span>(<span class="ruby-identifier">nenv</span>.<span class="ruby-identifier">stack</span>.<span class="ruby-identifier">size</span> <span class="ruby-operator">-</span> <span class="ruby-identifier">stack_depth</span>)
          <span class="ruby-identifier">nenv</span> = <span class="ruby-identifier">nenv</span>.<span class="ruby-identifier">push</span>(<span class="ruby-identifier">ty</span>)
          <span class="ruby-identifier">tmp_ep</span> = <span class="ruby-identifier">tmp_ep</span>.<span class="ruby-identifier">jump</span>(<span class="ruby-identifier">cont</span>)
          <span class="ruby-identifier">merge_env</span>(<span class="ruby-identifier">tmp_ep</span>, <span class="ruby-identifier">nenv</span>)
          <span class="ruby-keyword">break</span>
        <span class="ruby-keyword">end</span>
        <span class="ruby-identifier">tmp_ep</span> = <span class="ruby-identifier">tmp_ep</span>.<span class="ruby-identifier">outer</span>
      <span class="ruby-keyword">end</span>
    <span class="ruby-keyword">when</span> <span class="ruby-value">:next</span>, <span class="ruby-value">:redo</span>
      <span class="ruby-comment"># begin; rescue; next; end</span>
      <span class="ruby-identifier">tmp_ep</span> = <span class="ruby-identifier">ep</span>.<span class="ruby-identifier">outer</span>
      <span class="ruby-identifier">_type</span>, <span class="ruby-identifier">_iseq</span>, <span class="ruby-identifier">cont</span>, <span class="ruby-identifier">stack_depth</span> = <span class="ruby-identifier">tmp_ep</span>.<span class="ruby-identifier">ctx</span>.<span class="ruby-identifier">iseq</span>.<span class="ruby-identifier">catch_table</span>[<span class="ruby-identifier">tmp_ep</span>.<span class="ruby-identifier">pc</span>].<span class="ruby-identifier">find</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">type</span>,<span class="ruby-operator">|</span> <span class="ruby-identifier">type</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">throwtype</span> }
      <span class="ruby-identifier">nenv</span> = <span class="ruby-ivar">@return_envs</span>[<span class="ruby-identifier">tmp_ep</span>]
      <span class="ruby-identifier">nenv</span>, = <span class="ruby-identifier">nenv</span>.<span class="ruby-identifier">pop</span>(<span class="ruby-identifier">nenv</span>.<span class="ruby-identifier">stack</span>.<span class="ruby-identifier">size</span> <span class="ruby-operator">-</span> <span class="ruby-identifier">stack_depth</span>)
      <span class="ruby-identifier">nenv</span> = <span class="ruby-identifier">nenv</span>.<span class="ruby-identifier">push</span>(<span class="ruby-identifier">ty</span>) <span class="ruby-keyword">if</span> <span class="ruby-identifier">throwtype</span> <span class="ruby-operator">==</span> <span class="ruby-value">:next</span>
      <span class="ruby-identifier">tmp_ep</span> = <span class="ruby-identifier">tmp_ep</span>.<span class="ruby-identifier">jump</span>(<span class="ruby-identifier">cont</span>)
      <span class="ruby-identifier">merge_env</span>(<span class="ruby-identifier">tmp_ep</span>, <span class="ruby-identifier">nenv</span>)
    <span class="ruby-keyword">when</span> <span class="ruby-value">:retry</span>
      <span class="ruby-identifier">tmp_ep</span> = <span class="ruby-identifier">ep</span>.<span class="ruby-identifier">outer</span>
      <span class="ruby-identifier">_type</span>, <span class="ruby-identifier">_iseq</span>, <span class="ruby-identifier">cont</span>, <span class="ruby-identifier">stack_depth</span> = <span class="ruby-identifier">tmp_ep</span>.<span class="ruby-identifier">ctx</span>.<span class="ruby-identifier">iseq</span>.<span class="ruby-identifier">catch_table</span>[<span class="ruby-identifier">tmp_ep</span>.<span class="ruby-identifier">pc</span>].<span class="ruby-identifier">find</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">type</span>,<span class="ruby-operator">|</span> <span class="ruby-identifier">type</span> <span class="ruby-operator">==</span> <span class="ruby-value">:retry</span> }
      <span class="ruby-identifier">nenv</span> = <span class="ruby-ivar">@return_envs</span>[<span class="ruby-identifier">tmp_ep</span>]
      <span class="ruby-identifier">nenv</span>, = <span class="ruby-identifier">nenv</span>.<span class="ruby-identifier">pop</span>(<span class="ruby-identifier">nenv</span>.<span class="ruby-identifier">stack</span>.<span class="ruby-identifier">size</span> <span class="ruby-operator">-</span> <span class="ruby-identifier">stack_depth</span>)
      <span class="ruby-identifier">tmp_ep</span> = <span class="ruby-identifier">tmp_ep</span>.<span class="ruby-identifier">jump</span>(<span class="ruby-identifier">cont</span>)
      <span class="ruby-identifier">merge_env</span>(<span class="ruby-identifier">tmp_ep</span>, <span class="ruby-identifier">nenv</span>)
    <span class="ruby-keyword">else</span>
      <span class="ruby-identifier">p</span> <span class="ruby-identifier">throwtype</span>
      <span class="ruby-identifier">raise</span> <span class="ruby-constant">NotImplementedError</span>
    <span class="ruby-keyword">end</span>
    <span class="ruby-keyword">return</span>
  <span class="ruby-keyword">when</span> <span class="ruby-value">:once</span>
    <span class="ruby-identifier">iseq</span>, = <span class="ruby-identifier">operands</span>

    <span class="ruby-identifier">nctx</span> = <span class="ruby-constant">Context</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">iseq</span>, <span class="ruby-identifier">ep</span>.<span class="ruby-identifier">ctx</span>.<span class="ruby-identifier">cref</span>, <span class="ruby-identifier">ep</span>.<span class="ruby-identifier">ctx</span>.<span class="ruby-identifier">mid</span>)
    <span class="ruby-identifier">nep</span> = <span class="ruby-constant">ExecutionPoint</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">nctx</span>, <span class="ruby-value">0</span>, <span class="ruby-identifier">ep</span>)
    <span class="ruby-identifier">raise</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">iseq</span>.<span class="ruby-identifier">locals</span> <span class="ruby-operator">!=</span> []
    <span class="ruby-identifier">nenv</span> = <span class="ruby-constant">Env</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">env</span>.<span class="ruby-identifier">static_env</span>, [], [], <span class="ruby-keyword">nil</span>)
    <span class="ruby-identifier">merge_env</span>(<span class="ruby-identifier">nep</span>, <span class="ruby-identifier">nenv</span>)
    <span class="ruby-identifier">add_callsite!</span>(<span class="ruby-identifier">nep</span>.<span class="ruby-identifier">ctx</span>, <span class="ruby-identifier">ep</span>, <span class="ruby-identifier">env</span>) <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">ret_ty</span>, <span class="ruby-identifier">ep</span>, <span class="ruby-identifier">env</span><span class="ruby-operator">|</span>
      <span class="ruby-identifier">nenv</span>, <span class="ruby-identifier">ret_ty</span> = <span class="ruby-identifier">localize_type</span>(<span class="ruby-identifier">ret_ty</span>, <span class="ruby-identifier">env</span>, <span class="ruby-identifier">ep</span>)
      <span class="ruby-identifier">nenv</span> = <span class="ruby-identifier">nenv</span>.<span class="ruby-identifier">push</span>(<span class="ruby-identifier">ret_ty</span>)
      <span class="ruby-identifier">merge_env</span>(<span class="ruby-identifier">ep</span>.<span class="ruby-identifier">next</span>, <span class="ruby-identifier">nenv</span>)
    <span class="ruby-keyword">end</span>
    <span class="ruby-keyword">return</span>

  <span class="ruby-keyword">when</span> <span class="ruby-value">:branch</span> <span class="ruby-comment"># TODO: check how branchnil is used</span>
    <span class="ruby-identifier">branchtype</span>, <span class="ruby-identifier">target</span>, = <span class="ruby-identifier">operands</span>
    <span class="ruby-comment"># branchtype: :if or :unless or :nil</span>
    <span class="ruby-identifier">env</span>, (<span class="ruby-identifier">ty</span>,) = <span class="ruby-identifier">env</span>.<span class="ruby-identifier">pop</span>(<span class="ruby-value">1</span>)
    <span class="ruby-identifier">ep_then</span> = <span class="ruby-identifier">ep</span>.<span class="ruby-identifier">next</span>
    <span class="ruby-identifier">ep_else</span> = <span class="ruby-identifier">ep</span>.<span class="ruby-identifier">jump</span>(<span class="ruby-identifier">target</span>)

    <span class="ruby-comment"># TODO: it works for only simple cases: `x = nil; x || 1`</span>
    <span class="ruby-comment"># It would be good to merge &quot;dup; branchif&quot; to make it context-sensitive-like</span>
    <span class="ruby-identifier">falsy</span> = <span class="ruby-identifier">ty</span> <span class="ruby-operator">==</span> <span class="ruby-constant">Type</span>.<span class="ruby-identifier">nil</span>

    <span class="ruby-identifier">merge_env</span>(<span class="ruby-identifier">ep_then</span>, <span class="ruby-identifier">env</span>)
    <span class="ruby-identifier">merge_env</span>(<span class="ruby-identifier">ep_else</span>, <span class="ruby-identifier">env</span>) <span class="ruby-keyword">unless</span> <span class="ruby-identifier">branchtype</span> <span class="ruby-operator">==</span> <span class="ruby-value">:if</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">falsy</span>
    <span class="ruby-keyword">return</span>
  <span class="ruby-keyword">when</span> <span class="ruby-value">:jump</span>
    <span class="ruby-identifier">target</span>, = <span class="ruby-identifier">operands</span>
    <span class="ruby-identifier">merge_env</span>(<span class="ruby-identifier">ep</span>.<span class="ruby-identifier">jump</span>(<span class="ruby-identifier">target</span>), <span class="ruby-identifier">env</span>)
    <span class="ruby-keyword">return</span>

  <span class="ruby-keyword">when</span> <span class="ruby-value">:setinstancevariable</span>
    <span class="ruby-identifier">var</span>, = <span class="ruby-identifier">operands</span>
    <span class="ruby-identifier">env</span>, (<span class="ruby-identifier">ty</span>,) = <span class="ruby-identifier">env</span>.<span class="ruby-identifier">pop</span>(<span class="ruby-value">1</span>)
    <span class="ruby-identifier">recv</span> = <span class="ruby-identifier">env</span>.<span class="ruby-identifier">static_env</span>.<span class="ruby-identifier">recv_ty</span>
    <span class="ruby-identifier">set_instance_variable</span>(<span class="ruby-identifier">recv</span>, <span class="ruby-identifier">var</span>, <span class="ruby-identifier">ty</span>, <span class="ruby-identifier">ep</span>, <span class="ruby-identifier">env</span>)

  <span class="ruby-keyword">when</span> <span class="ruby-value">:getinstancevariable</span>
    <span class="ruby-identifier">var</span>, = <span class="ruby-identifier">operands</span>
    <span class="ruby-identifier">recv</span> = <span class="ruby-identifier">env</span>.<span class="ruby-identifier">static_env</span>.<span class="ruby-identifier">recv_ty</span>
    <span class="ruby-identifier">get_instance_variable</span>(<span class="ruby-identifier">recv</span>, <span class="ruby-identifier">var</span>, <span class="ruby-identifier">ep</span>, <span class="ruby-identifier">env</span>) <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">ty</span>, <span class="ruby-identifier">nenv</span><span class="ruby-operator">|</span>
      <span class="ruby-identifier">merge_env</span>(<span class="ruby-identifier">ep</span>.<span class="ruby-identifier">next</span>, <span class="ruby-identifier">nenv</span>.<span class="ruby-identifier">push</span>(<span class="ruby-identifier">ty</span>))
    <span class="ruby-keyword">end</span>
    <span class="ruby-keyword">return</span>

  <span class="ruby-keyword">when</span> <span class="ruby-value">:setclassvariable</span>
    <span class="ruby-identifier">var</span>, = <span class="ruby-identifier">operands</span>
    <span class="ruby-identifier">env</span>, (<span class="ruby-identifier">ty</span>,) = <span class="ruby-identifier">env</span>.<span class="ruby-identifier">pop</span>(<span class="ruby-value">1</span>)
    <span class="ruby-identifier">cbase</span> = <span class="ruby-identifier">ep</span>.<span class="ruby-identifier">ctx</span>.<span class="ruby-identifier">cref</span>.<span class="ruby-identifier">klass</span>
    <span class="ruby-identifier">ty</span> = <span class="ruby-identifier">globalize_type</span>(<span class="ruby-identifier">ty</span>, <span class="ruby-identifier">env</span>, <span class="ruby-identifier">ep</span>)
    <span class="ruby-comment"># TODO: if superclass has the variable, it should be updated</span>
    <span class="ruby-identifier">add_cvar_write!</span>(<span class="ruby-identifier">cbase</span>, <span class="ruby-identifier">var</span>, <span class="ruby-identifier">ty</span>, <span class="ruby-identifier">ep</span>)

  <span class="ruby-keyword">when</span> <span class="ruby-value">:getclassvariable</span>
    <span class="ruby-identifier">var</span>, = <span class="ruby-identifier">operands</span>
    <span class="ruby-identifier">cbase</span> = <span class="ruby-identifier">ep</span>.<span class="ruby-identifier">ctx</span>.<span class="ruby-identifier">cref</span>.<span class="ruby-identifier">klass</span>
    <span class="ruby-comment"># TODO: if superclass has the variable, it should be read</span>
    <span class="ruby-identifier">add_cvar_read!</span>(<span class="ruby-identifier">cbase</span>, <span class="ruby-identifier">var</span>, <span class="ruby-identifier">ep</span>) <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">ty</span>, <span class="ruby-identifier">ep</span><span class="ruby-operator">|</span>
      <span class="ruby-identifier">nenv</span>, <span class="ruby-identifier">ty</span> = <span class="ruby-identifier">localize_type</span>(<span class="ruby-identifier">ty</span>, <span class="ruby-identifier">env</span>, <span class="ruby-identifier">ep</span>)
      <span class="ruby-identifier">merge_env</span>(<span class="ruby-identifier">ep</span>.<span class="ruby-identifier">next</span>, <span class="ruby-identifier">nenv</span>.<span class="ruby-identifier">push</span>(<span class="ruby-identifier">ty</span>))
    <span class="ruby-keyword">end</span>
    <span class="ruby-keyword">return</span>

  <span class="ruby-keyword">when</span> <span class="ruby-value">:setglobal</span>
    <span class="ruby-identifier">var</span>, = <span class="ruby-identifier">operands</span>
    <span class="ruby-identifier">env</span>, (<span class="ruby-identifier">ty</span>,) = <span class="ruby-identifier">env</span>.<span class="ruby-identifier">pop</span>(<span class="ruby-value">1</span>)
    <span class="ruby-identifier">ty</span> = <span class="ruby-identifier">globalize_type</span>(<span class="ruby-identifier">ty</span>, <span class="ruby-identifier">env</span>, <span class="ruby-identifier">ep</span>)
    <span class="ruby-identifier">add_gvar_write!</span>(<span class="ruby-identifier">var</span>, <span class="ruby-identifier">ty</span>, <span class="ruby-identifier">ep</span>)

  <span class="ruby-keyword">when</span> <span class="ruby-value">:getglobal</span>
    <span class="ruby-identifier">var</span>, = <span class="ruby-identifier">operands</span>
    <span class="ruby-identifier">ty</span> = <span class="ruby-constant">Type</span>.<span class="ruby-identifier">builtin_global_variable_type</span>(<span class="ruby-identifier">var</span>)
    <span class="ruby-keyword">if</span> <span class="ruby-identifier">ty</span>
      <span class="ruby-identifier">ty</span>, <span class="ruby-identifier">locs</span> = <span class="ruby-identifier">get_constant</span>(<span class="ruby-constant">Type</span><span class="ruby-operator">::</span><span class="ruby-constant">Builtin</span>[<span class="ruby-value">:obj</span>], <span class="ruby-identifier">ty</span>) <span class="ruby-keyword">if</span> <span class="ruby-identifier">ty</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Symbol</span>)
      <span class="ruby-identifier">env</span>, <span class="ruby-identifier">ty</span> = <span class="ruby-identifier">localize_type</span>(<span class="ruby-identifier">ty</span>, <span class="ruby-identifier">env</span>, <span class="ruby-identifier">ep</span>)
      <span class="ruby-identifier">env</span> = <span class="ruby-identifier">env</span>.<span class="ruby-identifier">push</span>(<span class="ruby-identifier">ty</span>)
    <span class="ruby-keyword">else</span>
      <span class="ruby-identifier">add_gvar_read!</span>(<span class="ruby-identifier">var</span>, <span class="ruby-identifier">ep</span>) <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">ty</span>, <span class="ruby-identifier">ep</span><span class="ruby-operator">|</span>
        <span class="ruby-identifier">nenv</span>, <span class="ruby-identifier">ty</span> = <span class="ruby-identifier">localize_type</span>(<span class="ruby-identifier">ty</span>, <span class="ruby-identifier">env</span>, <span class="ruby-identifier">ep</span>)
        <span class="ruby-identifier">merge_env</span>(<span class="ruby-identifier">ep</span>.<span class="ruby-identifier">next</span>, <span class="ruby-identifier">nenv</span>.<span class="ruby-identifier">push</span>(<span class="ruby-identifier">ty</span>))
      <span class="ruby-keyword">end</span>
      <span class="ruby-comment"># need to return default nil of global variables</span>
      <span class="ruby-keyword">return</span>
    <span class="ruby-keyword">end</span>

  <span class="ruby-keyword">when</span> <span class="ruby-value">:getlocal</span>
    <span class="ruby-identifier">var_idx</span>, <span class="ruby-identifier">scope_idx</span>, <span class="ruby-identifier">_escaped</span> = <span class="ruby-identifier">operands</span>
    <span class="ruby-keyword">if</span> <span class="ruby-identifier">scope_idx</span> <span class="ruby-operator">==</span> <span class="ruby-value">0</span>
      <span class="ruby-identifier">ty</span> = <span class="ruby-identifier">env</span>.<span class="ruby-identifier">get_local</span>(<span class="ruby-operator">-</span><span class="ruby-identifier">var_idx</span><span class="ruby-value">+2</span>)
    <span class="ruby-keyword">else</span>
      <span class="ruby-identifier">tmp_ep</span> = <span class="ruby-identifier">ep</span>
      <span class="ruby-identifier">scope_idx</span>.<span class="ruby-identifier">times</span> <span class="ruby-keyword">do</span>
        <span class="ruby-identifier">tmp_ep</span> = <span class="ruby-identifier">tmp_ep</span>.<span class="ruby-identifier">outer</span>
      <span class="ruby-keyword">end</span>
      <span class="ruby-identifier">ty</span> = <span class="ruby-ivar">@return_envs</span>[<span class="ruby-identifier">tmp_ep</span>].<span class="ruby-identifier">get_local</span>(<span class="ruby-operator">-</span><span class="ruby-identifier">var_idx</span><span class="ruby-value">+2</span>)
    <span class="ruby-keyword">end</span>
    <span class="ruby-identifier">env</span> = <span class="ruby-identifier">env</span>.<span class="ruby-identifier">push</span>(<span class="ruby-identifier">ty</span>)
  <span class="ruby-keyword">when</span> <span class="ruby-value">:getlocal_branch</span>
    <span class="ruby-identifier">getlocal_operands</span>, <span class="ruby-identifier">branch_operands</span> = <span class="ruby-identifier">operands</span>
    <span class="ruby-identifier">var_idx</span>, <span class="ruby-identifier">_scope_idx</span>, <span class="ruby-identifier">_escaped</span> = <span class="ruby-identifier">getlocal_operands</span>
    <span class="ruby-identifier">ret_ty</span> = <span class="ruby-identifier">env</span>.<span class="ruby-identifier">get_local</span>(<span class="ruby-operator">-</span><span class="ruby-identifier">var_idx</span><span class="ruby-value">+2</span>)

    <span class="ruby-identifier">branchtype</span>, <span class="ruby-identifier">target</span>, = <span class="ruby-identifier">branch_operands</span>
    <span class="ruby-comment"># branchtype: :if or :unless or :nil</span>
    <span class="ruby-identifier">ep_then</span> = <span class="ruby-identifier">ep</span>.<span class="ruby-identifier">next</span>
    <span class="ruby-identifier">ep_else</span> = <span class="ruby-identifier">ep</span>.<span class="ruby-identifier">jump</span>(<span class="ruby-identifier">target</span>)

    <span class="ruby-identifier">var_idx</span>, <span class="ruby-identifier">_scope_idx</span>, <span class="ruby-identifier">_escaped</span> = <span class="ruby-identifier">getlocal_operands</span>

    <span class="ruby-identifier">ret_ty</span>.<span class="ruby-identifier">each_child</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">ret_ty</span><span class="ruby-operator">|</span>
      <span class="ruby-identifier">flow_env</span> = <span class="ruby-identifier">env</span>.<span class="ruby-identifier">local_update</span>(<span class="ruby-operator">-</span><span class="ruby-identifier">var_idx</span><span class="ruby-value">+2</span>, <span class="ruby-identifier">ret_ty</span>)
      <span class="ruby-keyword">case</span> <span class="ruby-identifier">ret_ty</span>
      <span class="ruby-keyword">when</span> <span class="ruby-constant">Type</span>.<span class="ruby-identifier">any</span>
        <span class="ruby-identifier">merge_env</span>(<span class="ruby-identifier">ep_then</span>, <span class="ruby-identifier">flow_env</span>)
        <span class="ruby-identifier">merge_env</span>(<span class="ruby-identifier">ep_else</span>, <span class="ruby-identifier">flow_env</span>)
      <span class="ruby-keyword">when</span> <span class="ruby-constant">Type</span><span class="ruby-operator">::</span><span class="ruby-constant">Instance</span>.<span class="ruby-identifier">new</span>(<span class="ruby-constant">Type</span><span class="ruby-operator">::</span><span class="ruby-constant">Builtin</span>[<span class="ruby-value">:false</span>]), <span class="ruby-constant">Type</span>.<span class="ruby-identifier">nil</span>
        <span class="ruby-identifier">merge_env</span>(<span class="ruby-identifier">branchtype</span> <span class="ruby-operator">==</span> <span class="ruby-value">:if</span> <span class="ruby-operator">?</span> <span class="ruby-identifier">ep_then</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">ep_else</span>, <span class="ruby-identifier">flow_env</span>)
      <span class="ruby-keyword">else</span>
        <span class="ruby-identifier">merge_env</span>(<span class="ruby-identifier">branchtype</span> <span class="ruby-operator">==</span> <span class="ruby-value">:if</span> <span class="ruby-operator">?</span> <span class="ruby-identifier">ep_else</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">ep_then</span>, <span class="ruby-identifier">flow_env</span>)
      <span class="ruby-keyword">end</span>
    <span class="ruby-keyword">end</span>
    <span class="ruby-keyword">return</span>
  <span class="ruby-keyword">when</span> <span class="ruby-value">:getlocal_dup_branch</span>
    <span class="ruby-identifier">getlocal_operands</span>, <span class="ruby-identifier">_dup_operands</span>, <span class="ruby-identifier">branch_operands</span> = <span class="ruby-identifier">operands</span>
    <span class="ruby-identifier">var_idx</span>, <span class="ruby-identifier">_scope_idx</span>, <span class="ruby-identifier">_escaped</span> = <span class="ruby-identifier">getlocal_operands</span>
    <span class="ruby-identifier">ret_ty</span> = <span class="ruby-identifier">env</span>.<span class="ruby-identifier">get_local</span>(<span class="ruby-operator">-</span><span class="ruby-identifier">var_idx</span><span class="ruby-value">+2</span>)

    <span class="ruby-identifier">branchtype</span>, <span class="ruby-identifier">target</span>, = <span class="ruby-identifier">branch_operands</span>
    <span class="ruby-comment"># branchtype: :if or :unless or :nil</span>
    <span class="ruby-identifier">ep_then</span> = <span class="ruby-identifier">ep</span>.<span class="ruby-identifier">next</span>
    <span class="ruby-identifier">ep_else</span> = <span class="ruby-identifier">ep</span>.<span class="ruby-identifier">jump</span>(<span class="ruby-identifier">target</span>)

    <span class="ruby-identifier">ret_ty</span>.<span class="ruby-identifier">each_child</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">ret_ty</span><span class="ruby-operator">|</span>
      <span class="ruby-identifier">flow_env</span> = <span class="ruby-identifier">env</span>.<span class="ruby-identifier">local_update</span>(<span class="ruby-operator">-</span><span class="ruby-identifier">var_idx</span><span class="ruby-value">+2</span>, <span class="ruby-identifier">ret_ty</span>).<span class="ruby-identifier">push</span>(<span class="ruby-identifier">ret_ty</span>)
      <span class="ruby-keyword">case</span> <span class="ruby-identifier">ret_ty</span>
      <span class="ruby-keyword">when</span> <span class="ruby-constant">Type</span>.<span class="ruby-identifier">any</span>
        <span class="ruby-identifier">merge_env</span>(<span class="ruby-identifier">ep_then</span>, <span class="ruby-identifier">flow_env</span>)
        <span class="ruby-identifier">merge_env</span>(<span class="ruby-identifier">ep_else</span>, <span class="ruby-identifier">flow_env</span>)
      <span class="ruby-keyword">when</span> <span class="ruby-constant">Type</span><span class="ruby-operator">::</span><span class="ruby-constant">Instance</span>.<span class="ruby-identifier">new</span>(<span class="ruby-constant">Type</span><span class="ruby-operator">::</span><span class="ruby-constant">Builtin</span>[<span class="ruby-value">:false</span>]), <span class="ruby-constant">Type</span>.<span class="ruby-identifier">nil</span>
        <span class="ruby-identifier">merge_env</span>(<span class="ruby-identifier">branchtype</span> <span class="ruby-operator">==</span> <span class="ruby-value">:if</span> <span class="ruby-operator">?</span> <span class="ruby-identifier">ep_then</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">ep_else</span>, <span class="ruby-identifier">flow_env</span>)
      <span class="ruby-keyword">else</span>
        <span class="ruby-identifier">merge_env</span>(<span class="ruby-identifier">branchtype</span> <span class="ruby-operator">==</span> <span class="ruby-value">:if</span> <span class="ruby-operator">?</span> <span class="ruby-identifier">ep_else</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">ep_then</span>, <span class="ruby-identifier">flow_env</span>)
      <span class="ruby-keyword">end</span>
    <span class="ruby-keyword">end</span>
    <span class="ruby-keyword">return</span>
  <span class="ruby-keyword">when</span> <span class="ruby-value">:dup_setlocal_branch</span>
    <span class="ruby-identifier">_dup_operands</span>, <span class="ruby-identifier">setlocal_operands</span>, <span class="ruby-identifier">branch_operands</span> = <span class="ruby-identifier">operands</span>

    <span class="ruby-identifier">env</span>, (<span class="ruby-identifier">ret_ty</span>,) = <span class="ruby-identifier">env</span>.<span class="ruby-identifier">pop</span>(<span class="ruby-value">1</span>)

    <span class="ruby-identifier">var_idx</span>, <span class="ruby-identifier">_scope_idx</span>, <span class="ruby-identifier">_escaped</span> = <span class="ruby-identifier">setlocal_operands</span>

    <span class="ruby-identifier">branchtype</span>, <span class="ruby-identifier">target</span>, = <span class="ruby-identifier">branch_operands</span>
    <span class="ruby-comment"># branchtype: :if or :unless or :nil</span>
    <span class="ruby-identifier">ep_then</span> = <span class="ruby-identifier">ep</span>.<span class="ruby-identifier">next</span>
    <span class="ruby-identifier">ep_else</span> = <span class="ruby-identifier">ep</span>.<span class="ruby-identifier">jump</span>(<span class="ruby-identifier">target</span>)

    <span class="ruby-identifier">ret_ty</span>.<span class="ruby-identifier">each_child</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">ret_ty</span><span class="ruby-operator">|</span>
      <span class="ruby-identifier">flow_env</span> = <span class="ruby-identifier">env</span>.<span class="ruby-identifier">local_update</span>(<span class="ruby-operator">-</span><span class="ruby-identifier">var_idx</span><span class="ruby-value">+2</span>, <span class="ruby-identifier">ret_ty</span>)
      <span class="ruby-keyword">case</span> <span class="ruby-identifier">ret_ty</span>
      <span class="ruby-keyword">when</span> <span class="ruby-constant">Type</span>.<span class="ruby-identifier">any</span>
        <span class="ruby-identifier">merge_env</span>(<span class="ruby-identifier">ep_then</span>, <span class="ruby-identifier">flow_env</span>)
        <span class="ruby-identifier">merge_env</span>(<span class="ruby-identifier">ep_else</span>, <span class="ruby-identifier">flow_env</span>)
      <span class="ruby-keyword">when</span> <span class="ruby-constant">Type</span><span class="ruby-operator">::</span><span class="ruby-constant">Instance</span>.<span class="ruby-identifier">new</span>(<span class="ruby-constant">Type</span><span class="ruby-operator">::</span><span class="ruby-constant">Builtin</span>[<span class="ruby-value">:false</span>]), <span class="ruby-constant">Type</span>.<span class="ruby-identifier">nil</span>
        <span class="ruby-identifier">merge_env</span>(<span class="ruby-identifier">branchtype</span> <span class="ruby-operator">==</span> <span class="ruby-value">:if</span> <span class="ruby-operator">?</span> <span class="ruby-identifier">ep_then</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">ep_else</span>, <span class="ruby-identifier">flow_env</span>)
      <span class="ruby-keyword">else</span>
        <span class="ruby-identifier">merge_env</span>(<span class="ruby-identifier">branchtype</span> <span class="ruby-operator">==</span> <span class="ruby-value">:if</span> <span class="ruby-operator">?</span> <span class="ruby-identifier">ep_else</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">ep_then</span>, <span class="ruby-identifier">flow_env</span>)
      <span class="ruby-keyword">end</span>
    <span class="ruby-keyword">end</span>
    <span class="ruby-keyword">return</span>
  <span class="ruby-keyword">when</span> <span class="ruby-value">:getlocal_checkmatch_branch</span>
    <span class="ruby-identifier">getlocal_operands</span>, <span class="ruby-identifier">branch_operands</span> = <span class="ruby-identifier">operands</span>
    <span class="ruby-identifier">var_idx</span>, <span class="ruby-identifier">_scope_idx</span>, <span class="ruby-identifier">_escaped</span> = <span class="ruby-identifier">getlocal_operands</span>
    <span class="ruby-identifier">ret_ty</span> = <span class="ruby-identifier">env</span>.<span class="ruby-identifier">get_local</span>(<span class="ruby-operator">-</span><span class="ruby-identifier">var_idx</span><span class="ruby-value">+2</span>)

    <span class="ruby-identifier">env</span>, (<span class="ruby-identifier">pattern_ty</span>,) = <span class="ruby-identifier">env</span>.<span class="ruby-identifier">pop</span>(<span class="ruby-value">1</span>)

    <span class="ruby-identifier">branchtype</span>, <span class="ruby-identifier">target</span>, = <span class="ruby-identifier">branch_operands</span>
    <span class="ruby-comment"># branchtype: :if or :unless or :nil</span>
    <span class="ruby-identifier">ep_then</span> = <span class="ruby-identifier">ep</span>.<span class="ruby-identifier">next</span>
    <span class="ruby-identifier">ep_else</span> = <span class="ruby-identifier">ep</span>.<span class="ruby-identifier">jump</span>(<span class="ruby-identifier">target</span>)

    <span class="ruby-identifier">var_idx</span>, <span class="ruby-identifier">_scope_idx</span>, <span class="ruby-identifier">_escaped</span> = <span class="ruby-identifier">getlocal_operands</span>

    <span class="ruby-identifier">ret_ty</span>.<span class="ruby-identifier">each_child</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">ret_ty</span><span class="ruby-operator">|</span>
      <span class="ruby-identifier">flow_env</span> = <span class="ruby-identifier">env</span>.<span class="ruby-identifier">local_update</span>(<span class="ruby-operator">-</span><span class="ruby-identifier">var_idx</span><span class="ruby-value">+2</span>, <span class="ruby-identifier">ret_ty</span>)
      <span class="ruby-identifier">ret_ty</span> = <span class="ruby-identifier">ret_ty</span>.<span class="ruby-identifier">base_type</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">ret_ty</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Type</span><span class="ruby-operator">::</span><span class="ruby-constant">Symbol</span>)
      <span class="ruby-identifier">ret_ty</span> = <span class="ruby-identifier">ret_ty</span>.<span class="ruby-identifier">base_type</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">ret_ty</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Type</span><span class="ruby-operator">::</span><span class="ruby-constant">Local</span>)
      <span class="ruby-keyword">if</span> <span class="ruby-identifier">ret_ty</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Type</span><span class="ruby-operator">::</span><span class="ruby-constant">Instance</span>)
        <span class="ruby-keyword">if</span> <span class="ruby-identifier">ret_ty</span>.<span class="ruby-identifier">klass</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">pattern_ty</span> <span class="ruby-comment"># XXX: inheritance</span>
          <span class="ruby-identifier">merge_env</span>(<span class="ruby-identifier">branchtype</span> <span class="ruby-operator">==</span> <span class="ruby-value">:if</span> <span class="ruby-operator">?</span> <span class="ruby-identifier">ep_else</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">ep_then</span>, <span class="ruby-identifier">flow_env</span>)
        <span class="ruby-keyword">else</span>
          <span class="ruby-identifier">merge_env</span>(<span class="ruby-identifier">branchtype</span> <span class="ruby-operator">==</span> <span class="ruby-value">:if</span> <span class="ruby-operator">?</span> <span class="ruby-identifier">ep_then</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">ep_else</span>, <span class="ruby-identifier">flow_env</span>)
        <span class="ruby-keyword">end</span>
      <span class="ruby-keyword">else</span>
        <span class="ruby-identifier">merge_env</span>(<span class="ruby-identifier">ep_then</span>, <span class="ruby-identifier">flow_env</span>)
        <span class="ruby-identifier">merge_env</span>(<span class="ruby-identifier">ep_else</span>, <span class="ruby-identifier">flow_env</span>)
      <span class="ruby-keyword">end</span>
    <span class="ruby-keyword">end</span>
    <span class="ruby-keyword">return</span>
  <span class="ruby-keyword">when</span> <span class="ruby-value">:setlocal</span>, <span class="ruby-value">:setblockparam</span>
    <span class="ruby-identifier">var_idx</span>, <span class="ruby-identifier">scope_idx</span>, <span class="ruby-identifier">_escaped</span> = <span class="ruby-identifier">operands</span>
    <span class="ruby-identifier">env</span>, (<span class="ruby-identifier">ty</span>,) = <span class="ruby-identifier">env</span>.<span class="ruby-identifier">pop</span>(<span class="ruby-value">1</span>)
    <span class="ruby-keyword">if</span> <span class="ruby-identifier">scope_idx</span> <span class="ruby-operator">==</span> <span class="ruby-value">0</span>
      <span class="ruby-identifier">env</span> = <span class="ruby-identifier">env</span>.<span class="ruby-identifier">local_update</span>(<span class="ruby-operator">-</span><span class="ruby-identifier">var_idx</span><span class="ruby-value">+2</span>, <span class="ruby-identifier">ty</span>)
    <span class="ruby-keyword">else</span>
      <span class="ruby-identifier">tmp_ep</span> = <span class="ruby-identifier">ep</span>
      <span class="ruby-identifier">scope_idx</span>.<span class="ruby-identifier">times</span> <span class="ruby-keyword">do</span>
        <span class="ruby-identifier">tmp_ep</span> = <span class="ruby-identifier">tmp_ep</span>.<span class="ruby-identifier">outer</span>
      <span class="ruby-keyword">end</span>
      <span class="ruby-identifier">merge_return_env</span>(<span class="ruby-identifier">tmp_ep</span>) <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">env</span><span class="ruby-operator">|</span>
        <span class="ruby-identifier">env</span>.<span class="ruby-identifier">merge</span>(<span class="ruby-identifier">env</span>.<span class="ruby-identifier">local_update</span>(<span class="ruby-operator">-</span><span class="ruby-identifier">var_idx</span><span class="ruby-value">+2</span>, <span class="ruby-identifier">ty</span>))
      <span class="ruby-keyword">end</span>
    <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">when</span> <span class="ruby-value">:getconstant</span>
    <span class="ruby-identifier">name</span>, = <span class="ruby-identifier">operands</span>
    <span class="ruby-identifier">env</span>, (<span class="ruby-identifier">cbase</span>, <span class="ruby-identifier">_allow_nil</span>,) = <span class="ruby-identifier">env</span>.<span class="ruby-identifier">pop</span>(<span class="ruby-value">2</span>)
    <span class="ruby-keyword">if</span> <span class="ruby-identifier">cbase</span> <span class="ruby-operator">==</span> <span class="ruby-constant">Type</span>.<span class="ruby-identifier">nil</span>
      <span class="ruby-identifier">ty</span>, <span class="ruby-identifier">locs</span> = <span class="ruby-identifier">search_constant</span>(<span class="ruby-identifier">ep</span>.<span class="ruby-identifier">ctx</span>.<span class="ruby-identifier">cref</span>, <span class="ruby-identifier">name</span>)
      <span class="ruby-identifier">env</span>, <span class="ruby-identifier">ty</span> = <span class="ruby-identifier">localize_type</span>(<span class="ruby-identifier">ty</span>, <span class="ruby-identifier">env</span>, <span class="ruby-identifier">ep</span>)
      <span class="ruby-identifier">env</span> = <span class="ruby-identifier">env</span>.<span class="ruby-identifier">push</span>(<span class="ruby-identifier">ty</span>)
    <span class="ruby-keyword">elsif</span> <span class="ruby-identifier">cbase</span> <span class="ruby-operator">==</span> <span class="ruby-constant">Type</span>.<span class="ruby-identifier">any</span>
      <span class="ruby-identifier">env</span> = <span class="ruby-identifier">env</span>.<span class="ruby-identifier">push</span>(<span class="ruby-constant">Type</span>.<span class="ruby-identifier">any</span>) <span class="ruby-comment"># XXX: warning needed?</span>
    <span class="ruby-keyword">else</span>
      <span class="ruby-identifier">ty</span>, <span class="ruby-identifier">locs</span> = <span class="ruby-identifier">get_constant</span>(<span class="ruby-identifier">cbase</span>, <span class="ruby-identifier">name</span>)
      <span class="ruby-identifier">env</span>, <span class="ruby-identifier">ty</span> = <span class="ruby-identifier">localize_type</span>(<span class="ruby-identifier">ty</span>, <span class="ruby-identifier">env</span>, <span class="ruby-identifier">ep</span>)
      <span class="ruby-identifier">env</span> = <span class="ruby-identifier">env</span>.<span class="ruby-identifier">push</span>(<span class="ruby-identifier">ty</span>)
    <span class="ruby-keyword">end</span>
    <span class="ruby-identifier">locs</span>&amp;.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">loc</span><span class="ruby-operator">|</span>
      <span class="ruby-identifier">ep</span>.<span class="ruby-identifier">ctx</span>.<span class="ruby-identifier">iseq</span>.<span class="ruby-identifier">add_def_loc</span>(<span class="ruby-identifier">ep</span>.<span class="ruby-identifier">pc</span>, <span class="ruby-identifier">loc</span>)
    <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">when</span> <span class="ruby-value">:setconstant</span>
    <span class="ruby-identifier">name</span>, = <span class="ruby-identifier">operands</span>
    <span class="ruby-identifier">env</span>, (<span class="ruby-identifier">ty</span>, <span class="ruby-identifier">cbase</span>) = <span class="ruby-identifier">env</span>.<span class="ruby-identifier">pop</span>(<span class="ruby-value">2</span>)
    <span class="ruby-identifier">old_ty</span>, <span class="ruby-identifier">old_locs</span> = <span class="ruby-identifier">get_constant</span>(<span class="ruby-identifier">cbase</span>, <span class="ruby-identifier">name</span>)
    <span class="ruby-keyword">if</span> <span class="ruby-identifier">old_locs</span> <span class="ruby-operator">==</span> [<span class="ruby-keyword">nil</span>] <span class="ruby-comment"># RBS defined</span>
      <span class="ruby-comment"># TODO: it would be better to check if ty is consistent with old_ty (defined in RBS)</span>
      <span class="ruby-comment"># instead of extending the type</span>
      <span class="ruby-identifier">env</span>, <span class="ruby-identifier">old_ty</span> = <span class="ruby-identifier">localize_type</span>(<span class="ruby-identifier">globalize_type</span>(<span class="ruby-identifier">old_ty</span>, <span class="ruby-identifier">env</span>, <span class="ruby-identifier">ep</span>), <span class="ruby-identifier">env</span>, <span class="ruby-identifier">ep</span>)
      <span class="ruby-identifier">ty</span> = <span class="ruby-identifier">ty</span>.<span class="ruby-identifier">union</span>(<span class="ruby-identifier">old_ty</span>)
    <span class="ruby-keyword">elsif</span> <span class="ruby-identifier">old_ty</span> <span class="ruby-operator">!=</span> <span class="ruby-constant">Type</span>.<span class="ruby-identifier">any</span> <span class="ruby-comment"># XXX???</span>
      <span class="ruby-identifier">warn</span>(<span class="ruby-identifier">ep</span>, <span class="ruby-node">&quot;already initialized constant #{ Type::Instance.new(cbase).screen_name(self) }::#{ name }&quot;</span>)
    <span class="ruby-keyword">end</span>
    <span class="ruby-identifier">ty</span>.<span class="ruby-identifier">each_child</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">ty</span><span class="ruby-operator">|</span>
      <span class="ruby-keyword">if</span> <span class="ruby-identifier">ty</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Type</span><span class="ruby-operator">::</span><span class="ruby-constant">Class</span>) <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">cbase</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Type</span><span class="ruby-operator">::</span><span class="ruby-constant">Class</span>) <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">ty</span>.<span class="ruby-identifier">superclass</span> <span class="ruby-operator">==</span> <span class="ruby-constant">Type</span><span class="ruby-operator">::</span><span class="ruby-constant">Builtin</span>[<span class="ruby-value">:struct</span>]
        <span class="ruby-ivar">@class_defs</span>[<span class="ruby-identifier">ty</span>.<span class="ruby-identifier">idx</span>].<span class="ruby-identifier">name</span> = <span class="ruby-identifier">cbase_path</span>(<span class="ruby-identifier">cbase</span>) <span class="ruby-operator">+</span> [<span class="ruby-identifier">name</span>]
      <span class="ruby-keyword">end</span>
    <span class="ruby-keyword">end</span>
    <span class="ruby-identifier">add_constant</span>(<span class="ruby-identifier">cbase</span>, <span class="ruby-identifier">name</span>, <span class="ruby-identifier">globalize_type</span>(<span class="ruby-identifier">ty</span>, <span class="ruby-identifier">env</span>, <span class="ruby-identifier">ep</span>), <span class="ruby-identifier">ep</span>)

  <span class="ruby-keyword">when</span> <span class="ruby-value">:getspecial</span>
    <span class="ruby-identifier">key</span>, <span class="ruby-identifier">type</span> = <span class="ruby-identifier">operands</span>
    <span class="ruby-keyword">if</span> <span class="ruby-identifier">type</span> <span class="ruby-operator">==</span> <span class="ruby-value">0</span>
      <span class="ruby-keyword">case</span> <span class="ruby-identifier">key</span>
      <span class="ruby-keyword">when</span> <span class="ruby-value">0</span> <span class="ruby-comment"># VM_SVAR_LASTLINE</span>
        <span class="ruby-identifier">env</span> = <span class="ruby-identifier">env</span>.<span class="ruby-identifier">push</span>(<span class="ruby-constant">Type</span>.<span class="ruby-identifier">any</span>) <span class="ruby-comment"># or String | NilClass only?</span>
      <span class="ruby-keyword">when</span> <span class="ruby-value">1</span> <span class="ruby-comment"># VM_SVAR_BACKREF ($~)</span>
        <span class="ruby-identifier">merge_env</span>(<span class="ruby-identifier">ep</span>.<span class="ruby-identifier">next</span>, <span class="ruby-identifier">env</span>.<span class="ruby-identifier">push</span>(<span class="ruby-constant">Type</span><span class="ruby-operator">::</span><span class="ruby-constant">Instance</span>.<span class="ruby-identifier">new</span>(<span class="ruby-constant">Type</span><span class="ruby-operator">::</span><span class="ruby-constant">Builtin</span>[<span class="ruby-value">:matchdata</span>])))
        <span class="ruby-comment"># tentatively disabled; it is too conservative</span>
        <span class="ruby-comment">#merge_env(ep.next, env.push(Type.nil))</span>
        <span class="ruby-keyword">return</span>
      <span class="ruby-keyword">else</span> <span class="ruby-comment"># flip-flop</span>
        <span class="ruby-identifier">env</span> = <span class="ruby-identifier">env</span>.<span class="ruby-identifier">push</span>(<span class="ruby-constant">Type</span>.<span class="ruby-identifier">bool</span>)
      <span class="ruby-keyword">end</span>
    <span class="ruby-keyword">else</span>
      <span class="ruby-comment"># NTH_REF ($1, $2, ...) / BACK_REF ($&amp;, $+, ...)</span>
      <span class="ruby-identifier">merge_env</span>(<span class="ruby-identifier">ep</span>.<span class="ruby-identifier">next</span>, <span class="ruby-identifier">env</span>.<span class="ruby-identifier">push</span>(<span class="ruby-constant">Type</span><span class="ruby-operator">::</span><span class="ruby-constant">Instance</span>.<span class="ruby-identifier">new</span>(<span class="ruby-constant">Type</span><span class="ruby-operator">::</span><span class="ruby-constant">Builtin</span>[<span class="ruby-value">:str</span>])))
      <span class="ruby-comment"># tentatively disabled; it is too conservative</span>
      <span class="ruby-comment">#merge_env(ep.next, env.push(Type.nil))</span>
      <span class="ruby-keyword">return</span>
    <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">when</span> <span class="ruby-value">:setspecial</span>
    <span class="ruby-identifier">key</span>, = <span class="ruby-identifier">operands</span>
    <span class="ruby-keyword">if</span> <span class="ruby-identifier">key</span> <span class="ruby-operator">&gt;=</span> <span class="ruby-value">2</span> <span class="ruby-comment"># flip-flop</span>
      <span class="ruby-identifier">env</span>, = <span class="ruby-identifier">env</span>.<span class="ruby-identifier">pop</span>(<span class="ruby-value">1</span>)
    <span class="ruby-keyword">else</span>
      <span class="ruby-identifier">raise</span> <span class="ruby-node">&quot;unknown setspecial key: #{ key }&quot;</span>
    <span class="ruby-keyword">end</span>

  <span class="ruby-keyword">when</span> <span class="ruby-value">:dup</span>
    <span class="ruby-identifier">env</span>, (<span class="ruby-identifier">ty</span>,) = <span class="ruby-identifier">env</span>.<span class="ruby-identifier">pop</span>(<span class="ruby-value">1</span>)
    <span class="ruby-identifier">env</span> = <span class="ruby-identifier">env</span>.<span class="ruby-identifier">push</span>(<span class="ruby-identifier">ty</span>).<span class="ruby-identifier">push</span>(<span class="ruby-identifier">ty</span>)
  <span class="ruby-keyword">when</span> <span class="ruby-value">:dup_branch</span>
    <span class="ruby-identifier">_dup_operands</span>, <span class="ruby-identifier">branch_operands</span> = <span class="ruby-identifier">operands</span>
    <span class="ruby-identifier">env</span>, (<span class="ruby-identifier">ty</span>,) = <span class="ruby-identifier">env</span>.<span class="ruby-identifier">pop</span>(<span class="ruby-value">1</span>)

    <span class="ruby-identifier">branchtype</span>, <span class="ruby-identifier">target</span>, = <span class="ruby-identifier">branch_operands</span>
    <span class="ruby-comment"># branchtype: :if or :unless or :nil</span>
    <span class="ruby-identifier">ep_then</span> = <span class="ruby-identifier">ep</span>.<span class="ruby-identifier">next</span>
    <span class="ruby-identifier">ep_else</span> = <span class="ruby-identifier">ep</span>.<span class="ruby-identifier">jump</span>(<span class="ruby-identifier">target</span>)

    <span class="ruby-identifier">ty</span>.<span class="ruby-identifier">each_child</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">ty</span><span class="ruby-operator">|</span>
      <span class="ruby-identifier">flow_env</span> = <span class="ruby-identifier">env</span>.<span class="ruby-identifier">push</span>(<span class="ruby-identifier">ty</span>)
      <span class="ruby-keyword">case</span> <span class="ruby-identifier">ty</span>
      <span class="ruby-keyword">when</span> <span class="ruby-constant">Type</span>.<span class="ruby-identifier">any</span>
        <span class="ruby-identifier">merge_env</span>(<span class="ruby-identifier">ep_then</span>, <span class="ruby-identifier">flow_env</span>)
        <span class="ruby-identifier">merge_env</span>(<span class="ruby-identifier">ep_else</span>, <span class="ruby-identifier">flow_env</span>)
      <span class="ruby-keyword">when</span> <span class="ruby-constant">Type</span><span class="ruby-operator">::</span><span class="ruby-constant">Instance</span>.<span class="ruby-identifier">new</span>(<span class="ruby-constant">Type</span><span class="ruby-operator">::</span><span class="ruby-constant">Builtin</span>[<span class="ruby-value">:false</span>]), <span class="ruby-constant">Type</span>.<span class="ruby-identifier">nil</span>
        <span class="ruby-identifier">merge_env</span>(<span class="ruby-identifier">branchtype</span> <span class="ruby-operator">==</span> <span class="ruby-value">:if</span> <span class="ruby-operator">?</span> <span class="ruby-identifier">ep_then</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">ep_else</span>, <span class="ruby-identifier">flow_env</span>)
      <span class="ruby-keyword">else</span>
        <span class="ruby-identifier">merge_env</span>(<span class="ruby-identifier">branchtype</span> <span class="ruby-operator">==</span> <span class="ruby-value">:if</span> <span class="ruby-operator">?</span> <span class="ruby-identifier">ep_else</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">ep_then</span>, <span class="ruby-identifier">flow_env</span>)
      <span class="ruby-keyword">end</span>
    <span class="ruby-keyword">end</span>
    <span class="ruby-keyword">return</span>
  <span class="ruby-keyword">when</span> <span class="ruby-value">:duphash</span>
    <span class="ruby-identifier">raw_hash</span>, = <span class="ruby-identifier">operands</span>
    <span class="ruby-identifier">ty</span> = <span class="ruby-constant">Type</span>.<span class="ruby-identifier">guess_literal_type</span>(<span class="ruby-identifier">raw_hash</span>)
    <span class="ruby-identifier">env</span>, <span class="ruby-identifier">ty</span> = <span class="ruby-identifier">localize_type</span>(<span class="ruby-identifier">globalize_type</span>(<span class="ruby-identifier">ty</span>, <span class="ruby-identifier">env</span>, <span class="ruby-identifier">ep</span>), <span class="ruby-identifier">env</span>, <span class="ruby-identifier">ep</span>)
    <span class="ruby-identifier">env</span> = <span class="ruby-identifier">env</span>.<span class="ruby-identifier">push</span>(<span class="ruby-identifier">ty</span>)
  <span class="ruby-keyword">when</span> <span class="ruby-value">:dupn</span>
    <span class="ruby-identifier">n</span>, = <span class="ruby-identifier">operands</span>
    <span class="ruby-identifier">_</span>, <span class="ruby-identifier">tys</span> = <span class="ruby-identifier">env</span>.<span class="ruby-identifier">pop</span>(<span class="ruby-identifier">n</span>)
    <span class="ruby-identifier">tys</span>.<span class="ruby-identifier">each</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">ty</span><span class="ruby-operator">|</span> <span class="ruby-identifier">env</span> = <span class="ruby-identifier">env</span>.<span class="ruby-identifier">push</span>(<span class="ruby-identifier">ty</span>) }
  <span class="ruby-keyword">when</span> <span class="ruby-value">:pop</span>
    <span class="ruby-identifier">env</span>, = <span class="ruby-identifier">env</span>.<span class="ruby-identifier">pop</span>(<span class="ruby-value">1</span>)
  <span class="ruby-keyword">when</span> <span class="ruby-value">:swap</span>
    <span class="ruby-identifier">env</span>, (<span class="ruby-identifier">a</span>, <span class="ruby-identifier">b</span>) = <span class="ruby-identifier">env</span>.<span class="ruby-identifier">pop</span>(<span class="ruby-value">2</span>)
    <span class="ruby-identifier">env</span> = <span class="ruby-identifier">env</span>.<span class="ruby-identifier">push</span>(<span class="ruby-identifier">a</span>).<span class="ruby-identifier">push</span>(<span class="ruby-identifier">b</span>)
  <span class="ruby-keyword">when</span> <span class="ruby-value">:reverse</span>
    <span class="ruby-identifier">n</span>, = <span class="ruby-identifier">operands</span>
    <span class="ruby-identifier">env</span>, <span class="ruby-identifier">tys</span> = <span class="ruby-identifier">env</span>.<span class="ruby-identifier">pop</span>(<span class="ruby-identifier">n</span>)
    <span class="ruby-identifier">tys</span>.<span class="ruby-identifier">reverse_each</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">ty</span><span class="ruby-operator">|</span> <span class="ruby-identifier">env</span> = <span class="ruby-identifier">env</span>.<span class="ruby-identifier">push</span>(<span class="ruby-identifier">ty</span>) }
  <span class="ruby-keyword">when</span> <span class="ruby-value">:defined</span>
    <span class="ruby-identifier">env</span>, = <span class="ruby-identifier">env</span>.<span class="ruby-identifier">pop</span>(<span class="ruby-value">1</span>)
    <span class="ruby-identifier">sym_ty</span> = <span class="ruby-constant">Type</span><span class="ruby-operator">::</span><span class="ruby-constant">Symbol</span>.<span class="ruby-identifier">new</span>(<span class="ruby-keyword">nil</span>, <span class="ruby-constant">Type</span><span class="ruby-operator">::</span><span class="ruby-constant">Instance</span>.<span class="ruby-identifier">new</span>(<span class="ruby-constant">Type</span><span class="ruby-operator">::</span><span class="ruby-constant">Builtin</span>[<span class="ruby-value">:sym</span>]))
    <span class="ruby-identifier">env</span> = <span class="ruby-identifier">env</span>.<span class="ruby-identifier">push</span>(<span class="ruby-constant">Type</span>.<span class="ruby-identifier">optional</span>(<span class="ruby-identifier">sym_ty</span>))
  <span class="ruby-keyword">when</span> <span class="ruby-value">:checkmatch</span>
    <span class="ruby-identifier">flag</span>, = <span class="ruby-identifier">operands</span>

    <span class="ruby-comment"># This flag means that the stack top is an array, and the check needs to be applied to find all elements</span>
    <span class="ruby-comment"># However, currently TypeProf uses very conservative interpretation (all check returns both true and false),</span>
    <span class="ruby-comment"># so we just ignore the flag now</span>
    <span class="ruby-identifier">_array</span> = <span class="ruby-identifier">flag</span> <span class="ruby-operator">&amp;</span> <span class="ruby-value">4</span> <span class="ruby-operator">!=</span> <span class="ruby-value">0</span>

    <span class="ruby-keyword">case</span> <span class="ruby-identifier">flag</span> <span class="ruby-operator">&amp;</span> <span class="ruby-value">3</span>
    <span class="ruby-keyword">when</span> <span class="ruby-value">1</span> <span class="ruby-comment"># VM_CHECKMATCH_TYPE_WHEN</span>
      <span class="ruby-identifier">env</span>, = <span class="ruby-identifier">env</span>.<span class="ruby-identifier">pop</span>(<span class="ruby-value">2</span>)
      <span class="ruby-identifier">env</span> = <span class="ruby-identifier">env</span>.<span class="ruby-identifier">push</span>(<span class="ruby-constant">Type</span>.<span class="ruby-identifier">bool</span>)
    <span class="ruby-keyword">when</span> <span class="ruby-value">2</span> <span class="ruby-comment"># VM_CHECKMATCH_TYPE_CASE</span>
      <span class="ruby-identifier">env</span>, = <span class="ruby-identifier">env</span>.<span class="ruby-identifier">pop</span>(<span class="ruby-value">2</span>)
      <span class="ruby-identifier">env</span> = <span class="ruby-identifier">env</span>.<span class="ruby-identifier">push</span>(<span class="ruby-constant">Type</span>.<span class="ruby-identifier">bool</span>)
    <span class="ruby-keyword">when</span> <span class="ruby-value">3</span> <span class="ruby-comment"># VM_CHECKMATCH_TYPE_RESCUE</span>
      <span class="ruby-identifier">env</span>, = <span class="ruby-identifier">env</span>.<span class="ruby-identifier">pop</span>(<span class="ruby-value">2</span>)
      <span class="ruby-identifier">env</span> = <span class="ruby-identifier">env</span>.<span class="ruby-identifier">push</span>(<span class="ruby-constant">Type</span>.<span class="ruby-identifier">bool</span>)
    <span class="ruby-keyword">else</span>
      <span class="ruby-identifier">raise</span> <span class="ruby-string">&quot;unknown checkmatch flag&quot;</span>
    <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">when</span> <span class="ruby-value">:checkkeyword</span>
    <span class="ruby-identifier">env</span> = <span class="ruby-identifier">env</span>.<span class="ruby-identifier">push</span>(<span class="ruby-constant">Type</span>.<span class="ruby-identifier">bool</span>)
  <span class="ruby-keyword">when</span> <span class="ruby-value">:adjuststack</span>
    <span class="ruby-identifier">n</span>, = <span class="ruby-identifier">operands</span>
    <span class="ruby-identifier">env</span>, <span class="ruby-identifier">_</span> = <span class="ruby-identifier">env</span>.<span class="ruby-identifier">pop</span>(<span class="ruby-identifier">n</span>)
  <span class="ruby-keyword">when</span> <span class="ruby-value">:nop</span>
  <span class="ruby-keyword">when</span> <span class="ruby-value">:setn</span>
    <span class="ruby-identifier">idx</span>, = <span class="ruby-identifier">operands</span>
    <span class="ruby-keyword">if</span> <span class="ruby-identifier">idx</span> <span class="ruby-operator">&gt;=</span> <span class="ruby-value">1</span>
      <span class="ruby-identifier">env</span>, (<span class="ruby-identifier">ty</span>,) = <span class="ruby-identifier">env</span>.<span class="ruby-identifier">pop</span>(<span class="ruby-value">1</span>)
      <span class="ruby-identifier">env</span> = <span class="ruby-identifier">env</span>.<span class="ruby-identifier">setn</span>(<span class="ruby-identifier">idx</span>, <span class="ruby-identifier">ty</span>).<span class="ruby-identifier">push</span>(<span class="ruby-identifier">ty</span>)
    <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">when</span> <span class="ruby-value">:topn</span>
    <span class="ruby-identifier">idx</span>, = <span class="ruby-identifier">operands</span>
    <span class="ruby-identifier">env</span> = <span class="ruby-identifier">env</span>.<span class="ruby-identifier">topn</span>(<span class="ruby-identifier">idx</span>)

  <span class="ruby-keyword">when</span> <span class="ruby-value">:splatarray</span>
    <span class="ruby-identifier">env</span>, (<span class="ruby-identifier">ty</span>,) = <span class="ruby-identifier">env</span>.<span class="ruby-identifier">pop</span>(<span class="ruby-value">1</span>)
    <span class="ruby-comment"># XXX: vm_splat_array</span>
    <span class="ruby-identifier">env</span> = <span class="ruby-identifier">env</span>.<span class="ruby-identifier">push</span>(<span class="ruby-identifier">ty</span>)
  <span class="ruby-keyword">when</span> <span class="ruby-value">:expandarray</span>
    <span class="ruby-identifier">num</span>, <span class="ruby-identifier">flag</span> = <span class="ruby-identifier">operands</span>
    <span class="ruby-identifier">env</span>, (<span class="ruby-identifier">ary</span>,) = <span class="ruby-identifier">env</span>.<span class="ruby-identifier">pop</span>(<span class="ruby-value">1</span>)
    <span class="ruby-identifier">splat</span> = <span class="ruby-identifier">flag</span> <span class="ruby-operator">&amp;</span> <span class="ruby-value">1</span> <span class="ruby-operator">==</span> <span class="ruby-value">1</span>
    <span class="ruby-identifier">from_head</span> = <span class="ruby-identifier">flag</span> <span class="ruby-operator">&amp;</span> <span class="ruby-value">2</span> <span class="ruby-operator">==</span> <span class="ruby-value">0</span>
    <span class="ruby-identifier">ary</span>.<span class="ruby-identifier">each_child</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">ary</span><span class="ruby-operator">|</span>
      <span class="ruby-keyword">case</span> <span class="ruby-identifier">ary</span>
      <span class="ruby-keyword">when</span> <span class="ruby-constant">Type</span><span class="ruby-operator">::</span><span class="ruby-constant">Local</span>
        <span class="ruby-keyword">if</span> <span class="ruby-identifier">ary</span>.<span class="ruby-identifier">kind</span> <span class="ruby-operator">==</span> <span class="ruby-constant">Type</span><span class="ruby-operator">::</span><span class="ruby-constant">Array</span>
          <span class="ruby-identifier">elems</span> = <span class="ruby-identifier">get_container_elem_types</span>(<span class="ruby-identifier">env</span>, <span class="ruby-identifier">ep</span>, <span class="ruby-identifier">ary</span>.<span class="ruby-identifier">id</span>)
          <span class="ruby-identifier">elems</span> <span class="ruby-operator">||=</span> <span class="ruby-constant">Type</span><span class="ruby-operator">::</span><span class="ruby-constant">Array</span><span class="ruby-operator">::</span><span class="ruby-constant">Elements</span>.<span class="ruby-identifier">new</span>([], <span class="ruby-constant">Type</span>.<span class="ruby-identifier">any</span>) <span class="ruby-comment"># XXX</span>
        <span class="ruby-keyword">else</span>
          <span class="ruby-identifier">elems</span> = <span class="ruby-constant">Type</span><span class="ruby-operator">::</span><span class="ruby-constant">Array</span><span class="ruby-operator">::</span><span class="ruby-constant">Elements</span>.<span class="ruby-identifier">new</span>([], <span class="ruby-constant">Type</span>.<span class="ruby-identifier">any</span>) <span class="ruby-comment"># XXX</span>
        <span class="ruby-keyword">end</span>
        <span class="ruby-identifier">do_expand_array</span>(<span class="ruby-identifier">ep</span>, <span class="ruby-identifier">env</span>, <span class="ruby-identifier">elems</span>, <span class="ruby-identifier">num</span>, <span class="ruby-identifier">splat</span>, <span class="ruby-identifier">from_head</span>)
      <span class="ruby-keyword">when</span> <span class="ruby-constant">Type</span><span class="ruby-operator">::</span><span class="ruby-constant">Any</span>
        <span class="ruby-identifier">nnum</span> = <span class="ruby-identifier">num</span>
        <span class="ruby-identifier">nnum</span> <span class="ruby-operator">+=</span> <span class="ruby-value">1</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">splat</span>
        <span class="ruby-identifier">nenv</span> = <span class="ruby-identifier">env</span>
        <span class="ruby-identifier">nnum</span>.<span class="ruby-identifier">times</span> <span class="ruby-keyword">do</span>
          <span class="ruby-identifier">nenv</span> = <span class="ruby-identifier">nenv</span>.<span class="ruby-identifier">push</span>(<span class="ruby-constant">Type</span>.<span class="ruby-identifier">any</span>)
        <span class="ruby-keyword">end</span>
        <span class="ruby-identifier">add_edge</span>(<span class="ruby-identifier">ep</span>, <span class="ruby-identifier">ep</span>)
        <span class="ruby-identifier">merge_env</span>(<span class="ruby-identifier">ep</span>.<span class="ruby-identifier">next</span>, <span class="ruby-identifier">nenv</span>)
      <span class="ruby-keyword">else</span>
        <span class="ruby-comment"># TODO: call to_ary (or to_a?)</span>
        <span class="ruby-identifier">elems</span> = <span class="ruby-constant">Type</span><span class="ruby-operator">::</span><span class="ruby-constant">Array</span><span class="ruby-operator">::</span><span class="ruby-constant">Elements</span>.<span class="ruby-identifier">new</span>([<span class="ruby-identifier">ary</span>], <span class="ruby-constant">Type</span>.<span class="ruby-identifier">bot</span>)
        <span class="ruby-identifier">do_expand_array</span>(<span class="ruby-identifier">ep</span>, <span class="ruby-identifier">env</span>, <span class="ruby-identifier">elems</span>, <span class="ruby-identifier">num</span>, <span class="ruby-identifier">splat</span>, <span class="ruby-identifier">from_head</span>)
      <span class="ruby-keyword">end</span>
    <span class="ruby-keyword">end</span>
    <span class="ruby-keyword">return</span>
  <span class="ruby-keyword">when</span> <span class="ruby-value">:concatarray</span>
    <span class="ruby-identifier">env</span>, (<span class="ruby-identifier">ary1</span>, <span class="ruby-identifier">ary2</span>) = <span class="ruby-identifier">env</span>.<span class="ruby-identifier">pop</span>(<span class="ruby-value">2</span>)
    <span class="ruby-keyword">if</span> <span class="ruby-identifier">ary1</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Type</span><span class="ruby-operator">::</span><span class="ruby-constant">Local</span>) <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">ary1</span>.<span class="ruby-identifier">kind</span> <span class="ruby-operator">==</span> <span class="ruby-constant">Type</span><span class="ruby-operator">::</span><span class="ruby-constant">Array</span>
      <span class="ruby-identifier">elems1</span> = <span class="ruby-identifier">get_container_elem_types</span>(<span class="ruby-identifier">env</span>, <span class="ruby-identifier">ep</span>, <span class="ruby-identifier">ary1</span>.<span class="ruby-identifier">id</span>)
      <span class="ruby-keyword">if</span> <span class="ruby-identifier">ary2</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Type</span><span class="ruby-operator">::</span><span class="ruby-constant">Local</span>) <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">ary2</span>.<span class="ruby-identifier">kind</span> <span class="ruby-operator">==</span> <span class="ruby-constant">Type</span><span class="ruby-operator">::</span><span class="ruby-constant">Array</span>
        <span class="ruby-identifier">elems2</span> = <span class="ruby-identifier">get_container_elem_types</span>(<span class="ruby-identifier">env</span>, <span class="ruby-identifier">ep</span>, <span class="ruby-identifier">ary2</span>.<span class="ruby-identifier">id</span>)
        <span class="ruby-identifier">elems</span> = <span class="ruby-constant">Type</span><span class="ruby-operator">::</span><span class="ruby-constant">Array</span><span class="ruby-operator">::</span><span class="ruby-constant">Elements</span>.<span class="ruby-identifier">new</span>([], <span class="ruby-identifier">elems1</span>.<span class="ruby-identifier">squash</span>.<span class="ruby-identifier">union</span>(<span class="ruby-identifier">elems2</span>.<span class="ruby-identifier">squash</span>))
        <span class="ruby-identifier">env</span> = <span class="ruby-identifier">update_container_elem_types</span>(<span class="ruby-identifier">env</span>, <span class="ruby-identifier">ep</span>, <span class="ruby-identifier">ary1</span>.<span class="ruby-identifier">id</span>, <span class="ruby-identifier">ary1</span>.<span class="ruby-identifier">base_type</span>) { <span class="ruby-identifier">elems</span> }
        <span class="ruby-identifier">env</span> = <span class="ruby-identifier">env</span>.<span class="ruby-identifier">push</span>(<span class="ruby-identifier">ary1</span>)
      <span class="ruby-keyword">else</span>
        <span class="ruby-identifier">elems</span> = <span class="ruby-constant">Type</span><span class="ruby-operator">::</span><span class="ruby-constant">Array</span><span class="ruby-operator">::</span><span class="ruby-constant">Elements</span>.<span class="ruby-identifier">new</span>([], <span class="ruby-constant">Type</span>.<span class="ruby-identifier">any</span>)
        <span class="ruby-identifier">env</span> = <span class="ruby-identifier">update_container_elem_types</span>(<span class="ruby-identifier">env</span>, <span class="ruby-identifier">ep</span>, <span class="ruby-identifier">ary1</span>.<span class="ruby-identifier">id</span>, <span class="ruby-identifier">ary1</span>.<span class="ruby-identifier">base_type</span>) { <span class="ruby-identifier">elems</span> }
        <span class="ruby-identifier">env</span> = <span class="ruby-identifier">env</span>.<span class="ruby-identifier">push</span>(<span class="ruby-identifier">ary1</span>)
      <span class="ruby-keyword">end</span>
    <span class="ruby-keyword">else</span>
      <span class="ruby-identifier">ty</span> = <span class="ruby-constant">Type</span><span class="ruby-operator">::</span><span class="ruby-constant">Array</span>.<span class="ruby-identifier">new</span>(<span class="ruby-constant">Type</span><span class="ruby-operator">::</span><span class="ruby-constant">Array</span><span class="ruby-operator">::</span><span class="ruby-constant">Elements</span>.<span class="ruby-identifier">new</span>([], <span class="ruby-constant">Type</span>.<span class="ruby-identifier">any</span>), <span class="ruby-constant">Type</span><span class="ruby-operator">::</span><span class="ruby-constant">Instance</span>.<span class="ruby-identifier">new</span>(<span class="ruby-constant">Type</span><span class="ruby-operator">::</span><span class="ruby-constant">Builtin</span>[<span class="ruby-value">:ary</span>]))
      <span class="ruby-identifier">env</span>, <span class="ruby-identifier">ty</span> = <span class="ruby-identifier">localize_type</span>(<span class="ruby-identifier">ty</span>, <span class="ruby-identifier">env</span>, <span class="ruby-identifier">ep</span>)
      <span class="ruby-identifier">env</span> = <span class="ruby-identifier">env</span>.<span class="ruby-identifier">push</span>(<span class="ruby-identifier">ty</span>)
    <span class="ruby-keyword">end</span>

  <span class="ruby-keyword">when</span> <span class="ruby-value">:checktype</span>
    <span class="ruby-identifier">kind</span>, = <span class="ruby-identifier">operands</span>
    <span class="ruby-keyword">case</span> <span class="ruby-identifier">kind</span>
    <span class="ruby-keyword">when</span> <span class="ruby-value">5</span> <span class="ruby-keyword">then</span> <span class="ruby-identifier">klass</span> = <span class="ruby-value">:str</span>  <span class="ruby-comment"># T_STRING</span>
    <span class="ruby-keyword">when</span> <span class="ruby-value">7</span> <span class="ruby-keyword">then</span> <span class="ruby-identifier">klass</span> = <span class="ruby-value">:ary</span>  <span class="ruby-comment"># T_ARRAY</span>
    <span class="ruby-keyword">when</span> <span class="ruby-value">8</span> <span class="ruby-keyword">then</span> <span class="ruby-identifier">klass</span> = <span class="ruby-value">:hash</span> <span class="ruby-comment"># T_HASH</span>
    <span class="ruby-keyword">else</span>
      <span class="ruby-identifier">raise</span> <span class="ruby-constant">NotImplementedError</span>
    <span class="ruby-keyword">end</span>
    <span class="ruby-identifier">env</span>, (<span class="ruby-identifier">val</span>,) = <span class="ruby-identifier">env</span>.<span class="ruby-identifier">pop</span>(<span class="ruby-value">1</span>)
    <span class="ruby-identifier">ty</span> = <span class="ruby-constant">Type</span>.<span class="ruby-identifier">bot</span>
    <span class="ruby-identifier">val</span>.<span class="ruby-identifier">each_child</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">val</span><span class="ruby-operator">|</span>
    <span class="ruby-comment">#globalize_type(val, env, ep).each_child_global do |val|</span>
      <span class="ruby-identifier">val</span> = <span class="ruby-identifier">val</span>.<span class="ruby-identifier">base_type</span> <span class="ruby-keyword">while</span> <span class="ruby-identifier">val</span>.<span class="ruby-identifier">respond_to?</span>(<span class="ruby-value">:base_type</span>)
      <span class="ruby-keyword">case</span> <span class="ruby-identifier">val</span>
      <span class="ruby-keyword">when</span> <span class="ruby-constant">Type</span><span class="ruby-operator">::</span><span class="ruby-constant">Instance</span>.<span class="ruby-identifier">new</span>(<span class="ruby-constant">Type</span><span class="ruby-operator">::</span><span class="ruby-constant">Builtin</span>[<span class="ruby-identifier">klass</span>])
        <span class="ruby-identifier">ty</span> = <span class="ruby-identifier">ty</span>.<span class="ruby-identifier">union</span>(<span class="ruby-constant">Type</span><span class="ruby-operator">::</span><span class="ruby-constant">Instance</span>.<span class="ruby-identifier">new</span>(<span class="ruby-constant">Type</span><span class="ruby-operator">::</span><span class="ruby-constant">Builtin</span>[<span class="ruby-value">:true</span>]))
      <span class="ruby-keyword">when</span> <span class="ruby-constant">Type</span>.<span class="ruby-identifier">any</span>
        <span class="ruby-identifier">ty</span> = <span class="ruby-constant">Type</span>.<span class="ruby-identifier">bool</span>
      <span class="ruby-keyword">else</span>
        <span class="ruby-identifier">ty</span> = <span class="ruby-identifier">ty</span>.<span class="ruby-identifier">union</span>(<span class="ruby-constant">Type</span><span class="ruby-operator">::</span><span class="ruby-constant">Instance</span>.<span class="ruby-identifier">new</span>(<span class="ruby-constant">Type</span><span class="ruby-operator">::</span><span class="ruby-constant">Builtin</span>[<span class="ruby-value">:false</span>]))
      <span class="ruby-keyword">end</span>
    <span class="ruby-keyword">end</span>
    <span class="ruby-identifier">env</span> = <span class="ruby-identifier">env</span>.<span class="ruby-identifier">push</span>(<span class="ruby-identifier">ty</span>)
  <span class="ruby-keyword">else</span>
    <span class="ruby-identifier">raise</span> <span class="ruby-node">&quot;Unknown insn: #{ insn.insn }&quot;</span>
  <span class="ruby-keyword">end</span>

  <span class="ruby-identifier">add_edge</span>(<span class="ruby-identifier">ep</span>, <span class="ruby-identifier">ep</span>)
  <span class="ruby-identifier">merge_env</span>(<span class="ruby-identifier">ep</span>.<span class="ruby-identifier">next</span>, <span class="ruby-identifier">env</span>)

  <span class="ruby-keyword">if</span> <span class="ruby-identifier">ep</span>.<span class="ruby-identifier">ctx</span>.<span class="ruby-identifier">iseq</span>.<span class="ruby-identifier">catch_table</span>[<span class="ruby-identifier">ep</span>.<span class="ruby-identifier">pc</span>]
    <span class="ruby-identifier">ep</span>.<span class="ruby-identifier">ctx</span>.<span class="ruby-identifier">iseq</span>.<span class="ruby-identifier">catch_table</span>[<span class="ruby-identifier">ep</span>.<span class="ruby-identifier">pc</span>].<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">type</span>, <span class="ruby-identifier">iseq</span>, <span class="ruby-identifier">cont</span>, <span class="ruby-identifier">stack_depth</span><span class="ruby-operator">|</span>
      <span class="ruby-keyword">next</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">type</span> <span class="ruby-operator">!=</span> <span class="ruby-value">:rescue</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">type</span> <span class="ruby-operator">!=</span> <span class="ruby-value">:ensure</span>
      <span class="ruby-keyword">next</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">env</span>.<span class="ruby-identifier">stack</span>.<span class="ruby-identifier">size</span> <span class="ruby-operator">&lt;</span> <span class="ruby-identifier">stack_depth</span>
      <span class="ruby-identifier">cont_ep</span> = <span class="ruby-identifier">ep</span>.<span class="ruby-identifier">jump</span>(<span class="ruby-identifier">cont</span>)
      <span class="ruby-identifier">cont_env</span>, = <span class="ruby-identifier">env</span>.<span class="ruby-identifier">pop</span>(<span class="ruby-identifier">env</span>.<span class="ruby-identifier">stack</span>.<span class="ruby-identifier">size</span> <span class="ruby-operator">-</span> <span class="ruby-identifier">stack_depth</span>)
      <span class="ruby-identifier">nctx</span> = <span class="ruby-constant">Context</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">iseq</span>, <span class="ruby-identifier">ep</span>.<span class="ruby-identifier">ctx</span>.<span class="ruby-identifier">cref</span>, <span class="ruby-identifier">ep</span>.<span class="ruby-identifier">ctx</span>.<span class="ruby-identifier">mid</span>)
      <span class="ruby-identifier">nep</span> = <span class="ruby-constant">ExecutionPoint</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">nctx</span>, <span class="ruby-value">0</span>, <span class="ruby-identifier">cont_ep</span>)
      <span class="ruby-identifier">locals</span> = [<span class="ruby-constant">Type</span>.<span class="ruby-identifier">nil</span>] <span class="ruby-operator">*</span> <span class="ruby-identifier">iseq</span>.<span class="ruby-identifier">locals</span>.<span class="ruby-identifier">size</span>
      <span class="ruby-identifier">nenv</span> = <span class="ruby-constant">Env</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">env</span>.<span class="ruby-identifier">static_env</span>, <span class="ruby-identifier">locals</span>, [], <span class="ruby-constant">Utils</span><span class="ruby-operator">::</span><span class="ruby-constant">HashWrapper</span>.<span class="ruby-identifier">new</span>({}))
      <span class="ruby-identifier">merge_env</span>(<span class="ruby-identifier">nep</span>, <span class="ruby-identifier">nenv</span>)
      <span class="ruby-identifier">add_callsite!</span>(<span class="ruby-identifier">nep</span>.<span class="ruby-identifier">ctx</span>, <span class="ruby-identifier">cont_ep</span>, <span class="ruby-identifier">cont_env</span>) <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">ret_ty</span>, <span class="ruby-identifier">ep</span>, <span class="ruby-identifier">env</span><span class="ruby-operator">|</span>
        <span class="ruby-identifier">nenv</span>, <span class="ruby-identifier">ret_ty</span> = <span class="ruby-identifier">localize_type</span>(<span class="ruby-identifier">ret_ty</span>, <span class="ruby-identifier">env</span>, <span class="ruby-identifier">ep</span>)
        <span class="ruby-identifier">nenv</span> = <span class="ruby-identifier">nenv</span>.<span class="ruby-identifier">push</span>(<span class="ruby-identifier">ret_ty</span>)
        <span class="ruby-identifier">merge_env</span>(<span class="ruby-identifier">ep</span>.<span class="ruby-identifier">jump</span>(<span class="ruby-identifier">cont</span>), <span class="ruby-identifier">nenv</span>)
      <span class="ruby-keyword">end</span>
    <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-traverse_subclasses" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">traverse_subclasses</span><span
                                class="method-args">(klass) { |class_defs| ... }</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="traverse_subclasses-source">
            <pre><span class="ruby-comment"># File typeprof-0.21.8/lib/typeprof/analyzer.rb, line 592</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">traverse_subclasses</span>(<span class="ruby-identifier">klass</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">blk</span>)
  <span class="ruby-ivar">@class_defs</span>[<span class="ruby-identifier">klass</span>.<span class="ruby-identifier">idx</span>].<span class="ruby-identifier">subclasses</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">subclass</span><span class="ruby-operator">|</span>
    <span class="ruby-keyword">yield</span> <span class="ruby-ivar">@class_defs</span>[<span class="ruby-identifier">subclass</span>]
    <span class="ruby-identifier">traverse_subclasses</span>(<span class="ruby-ivar">@class_defs</span>[<span class="ruby-identifier">subclass</span>].<span class="ruby-identifier">klass_obj</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">blk</span>)
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-type_profile" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">type_profile</span><span
                                class="method-args">(cancel_token = nil)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="type_profile-source">
            <pre><span class="ruby-comment"># File typeprof-0.21.8/lib/typeprof/analyzer.rb, line 1033</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">type_profile</span>(<span class="ruby-identifier">cancel_token</span> = <span class="ruby-keyword">nil</span>)
  <span class="ruby-identifier">cancel_token</span> <span class="ruby-operator">||=</span> <span class="ruby-constant">Utils</span><span class="ruby-operator">::</span><span class="ruby-constant">TimerCancelToken</span>.<span class="ruby-identifier">new</span>(<span class="ruby-constant">Config</span>.<span class="ruby-identifier">current</span>.<span class="ruby-identifier">max_sec</span>)
  <span class="ruby-identifier">tick</span> = <span class="ruby-constant">Time</span>.<span class="ruby-identifier">now</span>
  <span class="ruby-identifier">iter_counter</span> = <span class="ruby-value">0</span>
  <span class="ruby-identifier">stat_eps</span> = <span class="ruby-constant">Utils</span><span class="ruby-operator">::</span><span class="ruby-constant">MutableSet</span>.<span class="ruby-identifier">new</span>

  <span class="ruby-identifier">prologue_ctx</span> = <span class="ruby-constant">Context</span>.<span class="ruby-identifier">new</span>(<span class="ruby-keyword">nil</span>, <span class="ruby-keyword">nil</span>, <span class="ruby-keyword">nil</span>)
  <span class="ruby-identifier">prologue_ep</span> = <span class="ruby-constant">ExecutionPoint</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">prologue_ctx</span>, <span class="ruby-value">-1</span>, <span class="ruby-keyword">nil</span>)
  <span class="ruby-identifier">prologue_env</span> = <span class="ruby-constant">Env</span>.<span class="ruby-identifier">new</span>(<span class="ruby-constant">StaticEnv</span>.<span class="ruby-identifier">new</span>(<span class="ruby-constant">Type</span>.<span class="ruby-identifier">bot</span>, <span class="ruby-constant">Type</span>.<span class="ruby-identifier">nil</span>, <span class="ruby-keyword">false</span>, <span class="ruby-keyword">true</span>), [], [], <span class="ruby-constant">Utils</span><span class="ruby-operator">::</span><span class="ruby-constant">HashWrapper</span>.<span class="ruby-identifier">new</span>({}))

  <span class="ruby-keyword">until</span> <span class="ruby-ivar">@entrypoints</span>.<span class="ruby-identifier">empty?</span>
    <span class="ruby-identifier">entrypoint</span> = <span class="ruby-ivar">@entrypoints</span>.<span class="ruby-identifier">shift</span>
    <span class="ruby-keyword">if</span> <span class="ruby-identifier">entrypoint</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">String</span>)
      <span class="ruby-identifier">file</span> = <span class="ruby-identifier">entrypoint</span>
      <span class="ruby-keyword">next</span> <span class="ruby-keyword">if</span> <span class="ruby-ivar">@loaded_files</span>[<span class="ruby-constant">File</span>.<span class="ruby-identifier">expand_path</span>(<span class="ruby-identifier">file</span>)]
      <span class="ruby-identifier">iseq</span>, = <span class="ruby-constant">ISeq</span>.<span class="ruby-identifier">compile</span>(<span class="ruby-identifier">file</span>)
    <span class="ruby-keyword">else</span>
      <span class="ruby-identifier">iseq</span> = <span class="ruby-identifier">entrypoint</span>
    <span class="ruby-keyword">end</span>

    <span class="ruby-ivar">@loaded_files</span>[<span class="ruby-identifier">iseq</span>.<span class="ruby-identifier">absolute_path</span>] = <span class="ruby-keyword">true</span>
    <span class="ruby-identifier">ep</span>, <span class="ruby-identifier">env</span> = <span class="ruby-constant">TypeProf</span>.<span class="ruby-identifier">starting_state</span>(<span class="ruby-identifier">iseq</span>)
    <span class="ruby-identifier">merge_env</span>(<span class="ruby-identifier">ep</span>, <span class="ruby-identifier">env</span>)
    <span class="ruby-identifier">add_callsite!</span>(<span class="ruby-identifier">ep</span>.<span class="ruby-identifier">ctx</span>, <span class="ruby-identifier">prologue_ep</span>, <span class="ruby-identifier">prologue_env</span>) {<span class="ruby-operator">|</span><span class="ruby-identifier">ty</span>, <span class="ruby-identifier">ep</span><span class="ruby-operator">|</span> }

    <span class="ruby-keyword">while</span> <span class="ruby-keyword">true</span>
      <span class="ruby-keyword">until</span> <span class="ruby-ivar">@worklist</span>.<span class="ruby-identifier">empty?</span>
        <span class="ruby-identifier">ep</span> = <span class="ruby-ivar">@worklist</span>.<span class="ruby-identifier">deletemin</span>

        <span class="ruby-identifier">iter_counter</span> <span class="ruby-operator">+=</span> <span class="ruby-value">1</span>
        <span class="ruby-keyword">if</span> <span class="ruby-constant">Config</span>.<span class="ruby-identifier">current</span>.<span class="ruby-identifier">options</span>[<span class="ruby-value">:show_indicator</span>]
          <span class="ruby-identifier">tick2</span> = <span class="ruby-constant">Time</span>.<span class="ruby-identifier">now</span>
          <span class="ruby-keyword">if</span> <span class="ruby-identifier">tick2</span> <span class="ruby-operator">-</span> <span class="ruby-identifier">tick</span> <span class="ruby-operator">&gt;=</span> <span class="ruby-value">1</span>
            <span class="ruby-identifier">tick</span> = <span class="ruby-identifier">tick2</span>
            <span class="ruby-identifier">$stderr</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-string">&quot;\rType Profiling... (%d instructions @ %s)\e[K&quot;</span> <span class="ruby-operator">%</span> [<span class="ruby-identifier">iter_counter</span>, <span class="ruby-identifier">ep</span>.<span class="ruby-identifier">source_location</span>]
            <span class="ruby-identifier">$stderr</span>.<span class="ruby-identifier">flush</span>
          <span class="ruby-keyword">end</span>
        <span class="ruby-keyword">end</span>

        <span class="ruby-keyword">if</span> (<span class="ruby-constant">Config</span>.<span class="ruby-identifier">current</span>.<span class="ruby-identifier">max_iter</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-constant">Config</span>.<span class="ruby-identifier">current</span>.<span class="ruby-identifier">max_iter</span> <span class="ruby-operator">&lt;=</span> <span class="ruby-identifier">iter_counter</span>) <span class="ruby-operator">||</span> <span class="ruby-identifier">cancel_token</span>.<span class="ruby-identifier">cancelled?</span>
          <span class="ruby-ivar">@terminated</span> = <span class="ruby-keyword">true</span>
          <span class="ruby-keyword">break</span>
        <span class="ruby-keyword">end</span>

        <span class="ruby-identifier">stat_eps</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">ep</span>
        <span class="ruby-identifier">step</span>(<span class="ruby-identifier">ep</span>)
      <span class="ruby-keyword">end</span>

      <span class="ruby-keyword">break</span> <span class="ruby-keyword">if</span> <span class="ruby-ivar">@terminated</span>

      <span class="ruby-keyword">break</span> <span class="ruby-keyword">unless</span> <span class="ruby-constant">Config</span>.<span class="ruby-identifier">current</span>.<span class="ruby-identifier">options</span>[<span class="ruby-value">:stub_execution</span>]

      <span class="ruby-keyword">begin</span>
        <span class="ruby-identifier">iseq</span>, (<span class="ruby-identifier">kind</span>, <span class="ruby-identifier">dummy_continuation</span>) = <span class="ruby-ivar">@pending_execution</span>.<span class="ruby-identifier">first</span>
        <span class="ruby-keyword">break</span> <span class="ruby-keyword">if</span> <span class="ruby-operator">!</span><span class="ruby-identifier">iseq</span>
        <span class="ruby-ivar">@pending_execution</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-identifier">iseq</span>)
      <span class="ruby-keyword">end</span> <span class="ruby-keyword">while</span> <span class="ruby-ivar">@executed_iseqs</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">iseq</span>)

      <span class="ruby-identifier">puts</span> <span class="ruby-node">&quot;DEBUG: trigger stub execution (#{ iseq&amp;.name || &quot;(nil)&quot; }): rest #{ @pending_execution.size }&quot;</span> <span class="ruby-keyword">if</span> <span class="ruby-constant">Config</span>.<span class="ruby-identifier">current</span>.<span class="ruby-identifier">verbose</span> <span class="ruby-operator">&gt;=</span> <span class="ruby-value">2</span>

      <span class="ruby-keyword">break</span> <span class="ruby-keyword">if</span> <span class="ruby-operator">!</span><span class="ruby-identifier">iseq</span>
      <span class="ruby-keyword">case</span> <span class="ruby-identifier">kind</span>
      <span class="ruby-keyword">when</span> <span class="ruby-value">:method</span>
        <span class="ruby-identifier">meth</span>, <span class="ruby-identifier">ep</span>, <span class="ruby-identifier">env</span> = <span class="ruby-identifier">dummy_continuation</span>
        <span class="ruby-identifier">merge_env</span>(<span class="ruby-identifier">ep</span>, <span class="ruby-identifier">env</span>)
        <span class="ruby-identifier">add_iseq_method_call!</span>(<span class="ruby-identifier">meth</span>, <span class="ruby-identifier">ep</span>.<span class="ruby-identifier">ctx</span>)

      <span class="ruby-keyword">when</span> <span class="ruby-value">:block</span>
        <span class="ruby-identifier">blk</span>, <span class="ruby-identifier">epenvs</span> = <span class="ruby-identifier">dummy_continuation</span>
        <span class="ruby-identifier">epenvs</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">ep</span>, <span class="ruby-identifier">env</span><span class="ruby-operator">|</span>
          <span class="ruby-identifier">merge_env</span>(<span class="ruby-identifier">ep</span>, <span class="ruby-identifier">env</span>)
          <span class="ruby-identifier">add_block_to_ctx!</span>(<span class="ruby-identifier">blk</span>.<span class="ruby-identifier">block_body</span>, <span class="ruby-identifier">ep</span>.<span class="ruby-identifier">ctx</span>)
        <span class="ruby-keyword">end</span>
      <span class="ruby-keyword">end</span>
    <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">end</span>

  <span class="ruby-identifier">$stderr</span>.<span class="ruby-identifier">print</span> <span class="ruby-string">&quot;\r\e[K&quot;</span> <span class="ruby-keyword">if</span> <span class="ruby-constant">Config</span>.<span class="ruby-identifier">current</span>.<span class="ruby-identifier">options</span>[<span class="ruby-value">:show_indicator</span>]

  <span class="ruby-identifier">stat_eps</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-update_container_elem_types" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">update_container_elem_types</span><span
                                class="method-args">(env, ep, id, base_type) { |elems| ... }</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="update_container_elem_types-source">
            <pre><span class="ruby-comment"># File typeprof-0.21.8/lib/typeprof/analyzer.rb, line 983</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">update_container_elem_types</span>(<span class="ruby-identifier">env</span>, <span class="ruby-identifier">ep</span>, <span class="ruby-identifier">id</span>, <span class="ruby-identifier">base_type</span>)
  <span class="ruby-keyword">if</span> <span class="ruby-identifier">ep</span>.<span class="ruby-identifier">outer</span>
    <span class="ruby-identifier">tmp_ep</span> = <span class="ruby-identifier">ep</span>
    <span class="ruby-identifier">tmp_ep</span> = <span class="ruby-identifier">tmp_ep</span>.<span class="ruby-identifier">outer</span> <span class="ruby-keyword">while</span> <span class="ruby-identifier">tmp_ep</span>.<span class="ruby-identifier">outer</span>
    <span class="ruby-identifier">merge_return_env</span>(<span class="ruby-identifier">tmp_ep</span>) <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">menv</span><span class="ruby-operator">|</span>
      <span class="ruby-identifier">elems</span> = <span class="ruby-identifier">menv</span>.<span class="ruby-identifier">get_container_elem_types</span>(<span class="ruby-identifier">id</span>)
      <span class="ruby-identifier">elems</span> = <span class="ruby-keyword">yield</span> <span class="ruby-identifier">elems</span>
      <span class="ruby-identifier">menv</span> = <span class="ruby-identifier">menv</span>.<span class="ruby-identifier">deploy_type</span>(<span class="ruby-identifier">id</span>, <span class="ruby-identifier">elems</span>)
      <span class="ruby-identifier">gid</span> = <span class="ruby-ivar">@alloc_site_to_global_id</span>[<span class="ruby-identifier">id</span>]
      <span class="ruby-keyword">if</span> <span class="ruby-identifier">gid</span>
        <span class="ruby-identifier">ty</span> = <span class="ruby-identifier">globalize_type</span>(<span class="ruby-identifier">elems</span>.<span class="ruby-identifier">to_local_type</span>(<span class="ruby-identifier">id</span>, <span class="ruby-identifier">base_type</span>), <span class="ruby-identifier">env</span>, <span class="ruby-identifier">ep</span>)
        <span class="ruby-identifier">add_ivar_write!</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">gid</span>, <span class="ruby-identifier">ty</span>, <span class="ruby-identifier">ep</span>)
      <span class="ruby-keyword">end</span>
      <span class="ruby-identifier">menv</span>
    <span class="ruby-keyword">end</span>
    <span class="ruby-identifier">env</span>
  <span class="ruby-keyword">else</span>
    <span class="ruby-identifier">elems</span> = <span class="ruby-identifier">env</span>.<span class="ruby-identifier">get_container_elem_types</span>(<span class="ruby-identifier">id</span>)
    <span class="ruby-identifier">elems</span> = <span class="ruby-keyword">yield</span> <span class="ruby-identifier">elems</span>
    <span class="ruby-identifier">env</span> = <span class="ruby-identifier">env</span>.<span class="ruby-identifier">deploy_type</span>(<span class="ruby-identifier">id</span>, <span class="ruby-identifier">elems</span>)
    <span class="ruby-identifier">gid</span> = <span class="ruby-ivar">@alloc_site_to_global_id</span>[<span class="ruby-identifier">id</span>]
    <span class="ruby-keyword">if</span> <span class="ruby-identifier">gid</span>
      <span class="ruby-identifier">ty</span> = <span class="ruby-identifier">globalize_type</span>(<span class="ruby-identifier">elems</span>.<span class="ruby-identifier">to_local_type</span>(<span class="ruby-identifier">id</span>, <span class="ruby-identifier">base_type</span>), <span class="ruby-identifier">env</span>, <span class="ruby-identifier">ep</span>)
      <span class="ruby-identifier">add_ivar_write!</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">gid</span>, <span class="ruby-identifier">ty</span>, <span class="ruby-identifier">ep</span>)
    <span class="ruby-keyword">end</span>
    <span class="ruby-identifier">env</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-warn" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">warn</span><span
                                class="method-args">(ep, msg)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="warn-source">
            <pre><span class="ruby-comment"># File typeprof-0.21.8/lib/typeprof/analyzer.rb, line 959</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">warn</span>(<span class="ruby-identifier">ep</span>, <span class="ruby-identifier">msg</span>)
  <span class="ruby-identifier">p</span> [<span class="ruby-identifier">ep</span>.<span class="ruby-identifier">source_location</span>, <span class="ruby-string">&quot;[warning] &quot;</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">msg</span>] <span class="ruby-keyword">if</span> <span class="ruby-constant">Config</span>.<span class="ruby-identifier">current</span>.<span class="ruby-identifier">verbose</span> <span class="ruby-operator">&gt;=</span> <span class="ruby-value">2</span>
  <span class="ruby-ivar">@errors</span> <span class="ruby-operator">&lt;&lt;</span> [<span class="ruby-identifier">ep</span>, <span class="ruby-string">&quot;[warning] &quot;</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">msg</span>]
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                          </section>

                <section id="private-instance-5Buntitled-5D-method-details" class="method-section">
                <header>
                <h3>Private Instance Methods</h3>
                </header>

                  <div id="method-i-do_expand_array" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">do_expand_array</span><span
                                class="method-args">(ep, env, elems, num, splat, from_head)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="do_expand_array-source">
            <pre><span class="ruby-comment"># File typeprof-0.21.8/lib/typeprof/analyzer.rb, line 2211</span>
        <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">do_expand_array</span>(<span class="ruby-identifier">ep</span>, <span class="ruby-identifier">env</span>, <span class="ruby-identifier">elems</span>, <span class="ruby-identifier">num</span>, <span class="ruby-identifier">splat</span>, <span class="ruby-identifier">from_head</span>)
  <span class="ruby-keyword">if</span> <span class="ruby-identifier">from_head</span>
    <span class="ruby-identifier">lead_tys</span>, <span class="ruby-identifier">rest_ary_ty</span> = <span class="ruby-identifier">elems</span>.<span class="ruby-identifier">take_first</span>(<span class="ruby-identifier">num</span>)
    <span class="ruby-keyword">if</span> <span class="ruby-identifier">splat</span>
      <span class="ruby-identifier">env</span>, <span class="ruby-identifier">local_ary_ty</span> = <span class="ruby-identifier">localize_type</span>(<span class="ruby-identifier">rest_ary_ty</span>, <span class="ruby-identifier">env</span>, <span class="ruby-identifier">ep</span>)
      <span class="ruby-identifier">env</span> = <span class="ruby-identifier">env</span>.<span class="ruby-identifier">push</span>(<span class="ruby-identifier">local_ary_ty</span>)
    <span class="ruby-keyword">end</span>
    <span class="ruby-identifier">lead_tys</span>.<span class="ruby-identifier">reverse_each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">ty</span><span class="ruby-operator">|</span>
      <span class="ruby-identifier">env</span> = <span class="ruby-identifier">env</span>.<span class="ruby-identifier">push</span>(<span class="ruby-identifier">ty</span>)
    <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">else</span>
    <span class="ruby-identifier">rest_ary_ty</span>, <span class="ruby-identifier">following_tys</span> = <span class="ruby-identifier">elems</span>.<span class="ruby-identifier">take_last</span>(<span class="ruby-identifier">num</span>)
    <span class="ruby-identifier">following_tys</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">ty</span><span class="ruby-operator">|</span>
      <span class="ruby-identifier">env</span> = <span class="ruby-identifier">env</span>.<span class="ruby-identifier">push</span>(<span class="ruby-identifier">ty</span>)
    <span class="ruby-keyword">end</span>
    <span class="ruby-keyword">if</span> <span class="ruby-identifier">splat</span>
      <span class="ruby-identifier">env</span>, <span class="ruby-identifier">local_ary_ty</span> = <span class="ruby-identifier">localize_type</span>(<span class="ruby-identifier">rest_ary_ty</span>, <span class="ruby-identifier">env</span>, <span class="ruby-identifier">ep</span>)
      <span class="ruby-identifier">env</span> = <span class="ruby-identifier">env</span>.<span class="ruby-identifier">push</span>(<span class="ruby-identifier">local_ary_ty</span>)
    <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">end</span>
  <span class="ruby-identifier">merge_env</span>(<span class="ruby-identifier">ep</span>.<span class="ruby-identifier">next</span>, <span class="ruby-identifier">env</span>)
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-ruby_3_3_keywords-3F" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">ruby_3_3_keywords?</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="ruby_3_3_keywords-3F-source">
            <pre><span class="ruby-comment"># File typeprof-0.21.8/lib/typeprof/analyzer.rb, line 2234</span>
        <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">ruby_3_3_keywords?</span>
  <span class="ruby-ivar">@ruby_3_3_keywords</span> <span class="ruby-operator">||=</span>
    <span class="ruby-constant">RubyVM</span><span class="ruby-operator">::</span><span class="ruby-constant">InstructionSequence</span>.<span class="ruby-identifier">compile</span>(<span class="ruby-string">&quot;foo(*a, **b)&quot;</span>).<span class="ruby-identifier">to_a</span>.<span class="ruby-identifier">last</span>[<span class="ruby-value">-2</span>][<span class="ruby-value">1</span>][<span class="ruby-value">:orig_argc</span>] <span class="ruby-operator">==</span> <span class="ruby-value">2</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-setup_actual_arguments" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">setup_actual_arguments</span><span
                                class="method-args">(kind, operands, ep, env)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="setup_actual_arguments-source">
            <pre><span class="ruby-comment"># File typeprof-0.21.8/lib/typeprof/analyzer.rb, line 2262</span>
        <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">setup_actual_arguments</span>(<span class="ruby-identifier">kind</span>, <span class="ruby-identifier">operands</span>, <span class="ruby-identifier">ep</span>, <span class="ruby-identifier">env</span>)
  <span class="ruby-identifier">opt</span>, <span class="ruby-identifier">blk_iseq</span> = <span class="ruby-identifier">operands</span>
  <span class="ruby-identifier">flags</span> = <span class="ruby-identifier">opt</span>[<span class="ruby-value">:flag</span>]
  <span class="ruby-identifier">mid</span> = <span class="ruby-identifier">opt</span>[<span class="ruby-value">:mid</span>]
  <span class="ruby-identifier">kw_arg</span> = <span class="ruby-identifier">opt</span>[<span class="ruby-value">:kw_arg</span>]
  <span class="ruby-identifier">argc</span> = <span class="ruby-identifier">opt</span>[<span class="ruby-value">:orig_argc</span>]
  <span class="ruby-identifier">argc</span> <span class="ruby-operator">+=</span> <span class="ruby-value">1</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">kind</span> <span class="ruby-operator">==</span> <span class="ruby-value">:method</span> <span class="ruby-comment"># for the receiver</span>
  <span class="ruby-identifier">argc</span> <span class="ruby-operator">+=</span> <span class="ruby-identifier">kw_arg</span>.<span class="ruby-identifier">size</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">kw_arg</span>

  <span class="ruby-identifier">flag_args_splat</span>    = <span class="ruby-identifier">flags</span>[ <span class="ruby-value">0</span>] <span class="ruby-operator">!=</span> <span class="ruby-value">0</span>
  <span class="ruby-identifier">flag_args_blockarg</span> = <span class="ruby-identifier">flags</span>[ <span class="ruby-value">1</span>] <span class="ruby-operator">!=</span> <span class="ruby-value">0</span>
  <span class="ruby-identifier">_flag_args_fcall</span>   = <span class="ruby-identifier">flags</span>[ <span class="ruby-value">2</span>] <span class="ruby-operator">!=</span> <span class="ruby-value">0</span>
  <span class="ruby-identifier">_flag_args_vcall</span>   = <span class="ruby-identifier">flags</span>[ <span class="ruby-value">3</span>] <span class="ruby-operator">!=</span> <span class="ruby-value">0</span>
  <span class="ruby-identifier">_flag_args_simple</span>  = <span class="ruby-identifier">flags</span>[ <span class="ruby-value">4</span>] <span class="ruby-operator">!=</span> <span class="ruby-value">0</span> <span class="ruby-comment"># unused in TP</span>
  <span class="ruby-identifier">flags</span> <span class="ruby-operator">&lt;&lt;=</span> <span class="ruby-value">1</span> <span class="ruby-keyword">if</span> <span class="ruby-constant">RUBY_VERSION</span> <span class="ruby-operator">&gt;=</span> <span class="ruby-string">&quot;3.3&quot;</span> <span class="ruby-comment"># blockiseq flag was removed in 3.3</span>
  <span class="ruby-identifier">flag_args_kwarg</span>    = <span class="ruby-identifier">flags</span>[ <span class="ruby-value">6</span>] <span class="ruby-operator">!=</span> <span class="ruby-value">0</span>
  <span class="ruby-identifier">flag_args_kw_splat</span> = <span class="ruby-identifier">flags</span>[ <span class="ruby-value">7</span>] <span class="ruby-operator">!=</span> <span class="ruby-value">0</span>
  <span class="ruby-identifier">_flag_tailcall</span>     = <span class="ruby-identifier">flags</span>[ <span class="ruby-value">8</span>] <span class="ruby-operator">!=</span> <span class="ruby-value">0</span>
  <span class="ruby-identifier">_flag_super</span>        = <span class="ruby-identifier">flags</span>[ <span class="ruby-value">9</span>] <span class="ruby-operator">!=</span> <span class="ruby-value">0</span>
  <span class="ruby-identifier">_flag_zsuper</span>       = <span class="ruby-identifier">flags</span>[<span class="ruby-value">10</span>] <span class="ruby-operator">!=</span> <span class="ruby-value">0</span>

  <span class="ruby-identifier">argc</span> <span class="ruby-operator">+=</span> <span class="ruby-value">1</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">flag_args_blockarg</span>

  <span class="ruby-identifier">env</span>, <span class="ruby-identifier">aargs</span> = <span class="ruby-identifier">env</span>.<span class="ruby-identifier">pop</span>(<span class="ruby-identifier">argc</span>)

  <span class="ruby-identifier">recv</span> = <span class="ruby-identifier">aargs</span>.<span class="ruby-identifier">shift</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">kind</span> <span class="ruby-operator">==</span> <span class="ruby-value">:method</span>

  <span class="ruby-keyword">if</span> <span class="ruby-identifier">flag_args_blockarg</span>
    <span class="ruby-identifier">blk_ty</span> = <span class="ruby-identifier">aargs</span>.<span class="ruby-identifier">pop</span>
  <span class="ruby-keyword">elsif</span> <span class="ruby-identifier">blk_iseq</span>
    <span class="ruby-identifier">blk_ty</span> = <span class="ruby-constant">Type</span><span class="ruby-operator">::</span><span class="ruby-constant">Proc</span>.<span class="ruby-identifier">new</span>(<span class="ruby-constant">ISeqBlock</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">blk_iseq</span>, <span class="ruby-identifier">ep</span>), <span class="ruby-constant">Type</span><span class="ruby-operator">::</span><span class="ruby-constant">Instance</span>.<span class="ruby-identifier">new</span>(<span class="ruby-constant">Type</span><span class="ruby-operator">::</span><span class="ruby-constant">Builtin</span>[<span class="ruby-value">:proc</span>]))
  <span class="ruby-keyword">else</span>
    <span class="ruby-identifier">blk_ty</span> = <span class="ruby-constant">Type</span>.<span class="ruby-identifier">nil</span>
  <span class="ruby-keyword">end</span>

  <span class="ruby-identifier">new_blk_ty</span> = <span class="ruby-constant">Type</span>.<span class="ruby-identifier">bot</span>
  <span class="ruby-identifier">blk_ty</span>.<span class="ruby-identifier">each_child</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">blk_ty</span><span class="ruby-operator">|</span>
    <span class="ruby-keyword">case</span> <span class="ruby-identifier">blk_ty</span>
    <span class="ruby-keyword">when</span> <span class="ruby-constant">Type</span>.<span class="ruby-identifier">nil</span>
    <span class="ruby-keyword">when</span> <span class="ruby-constant">Type</span>.<span class="ruby-identifier">any</span>
    <span class="ruby-keyword">when</span> <span class="ruby-constant">Type</span><span class="ruby-operator">::</span><span class="ruby-constant">Proc</span>
    <span class="ruby-keyword">when</span> <span class="ruby-constant">Type</span><span class="ruby-operator">::</span><span class="ruby-constant">Symbol</span>
      <span class="ruby-identifier">blk_ty</span> = <span class="ruby-constant">Type</span><span class="ruby-operator">::</span><span class="ruby-constant">Proc</span>.<span class="ruby-identifier">new</span>(<span class="ruby-constant">SymbolBlock</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">blk_ty</span>.<span class="ruby-identifier">sym</span>), <span class="ruby-constant">Type</span><span class="ruby-operator">::</span><span class="ruby-constant">Instance</span>.<span class="ruby-identifier">new</span>(<span class="ruby-constant">Type</span><span class="ruby-operator">::</span><span class="ruby-constant">Builtin</span>[<span class="ruby-value">:proc</span>]))
    <span class="ruby-keyword">else</span>
      <span class="ruby-comment"># XXX: attempt to call to_proc</span>
      <span class="ruby-identifier">error</span>(<span class="ruby-identifier">ep</span>, <span class="ruby-node">&quot;wrong argument type #{ blk_ty.screen_name(self) } (expected Proc)&quot;</span>)
      <span class="ruby-identifier">blk_ty</span> = <span class="ruby-constant">Type</span>.<span class="ruby-identifier">any</span>
    <span class="ruby-keyword">end</span>
    <span class="ruby-identifier">new_blk_ty</span> = <span class="ruby-identifier">new_blk_ty</span>.<span class="ruby-identifier">union</span>(<span class="ruby-identifier">blk_ty</span>)
  <span class="ruby-keyword">end</span>
  <span class="ruby-identifier">blk_ty</span> = <span class="ruby-identifier">new_blk_ty</span>

  <span class="ruby-keyword">if</span> <span class="ruby-identifier">flag_args_splat</span>
    <span class="ruby-keyword">if</span> <span class="ruby-identifier">ruby_3_3_keywords?</span>
      <span class="ruby-keyword">if</span> <span class="ruby-identifier">flag_args_kw_splat</span>
        <span class="ruby-identifier">kw_tys</span> = <span class="ruby-identifier">type_to_keywords</span>(<span class="ruby-identifier">globalize_type</span>(<span class="ruby-identifier">aargs</span>[<span class="ruby-value">-1</span>], <span class="ruby-identifier">env</span>, <span class="ruby-identifier">ep</span>), <span class="ruby-identifier">ep</span>)
        <span class="ruby-identifier">aargs</span> = <span class="ruby-identifier">aargs</span>[<span class="ruby-value">0</span><span class="ruby-operator">..</span><span class="ruby-value">-2</span>]
      <span class="ruby-keyword">else</span>
        <span class="ruby-identifier">kw_tys</span> = {}
      <span class="ruby-keyword">end</span>
      <span class="ruby-identifier">rest_ty</span> = <span class="ruby-identifier">aargs</span>.<span class="ruby-identifier">last</span>
      <span class="ruby-identifier">aargs</span> = <span class="ruby-identifier">aargs</span>[<span class="ruby-value">0</span><span class="ruby-operator">..</span><span class="ruby-value">-2</span>]
    <span class="ruby-keyword">else</span>
      <span class="ruby-identifier">rest_ty</span> = <span class="ruby-identifier">aargs</span>.<span class="ruby-identifier">last</span>
      <span class="ruby-identifier">aargs</span> = <span class="ruby-identifier">aargs</span>[<span class="ruby-value">0</span><span class="ruby-operator">..</span><span class="ruby-value">-2</span>]
      <span class="ruby-keyword">if</span> <span class="ruby-identifier">flag_args_kw_splat</span>
        <span class="ruby-comment"># XXX: The types contained in ActualArguments are expected to be all local types.</span>
        <span class="ruby-comment"># This &quot;globalize_type&quot; breaks the invariant, and violates the assertion of Union#globalize that asserts @elems be nil.</span>
        <span class="ruby-comment"># To fix this issue fundamentally, ActualArguments should keep all arguments as-is (as like the VM does),</span>
        <span class="ruby-comment"># and globalize some types on the on-demand bases.</span>
        <span class="ruby-identifier">ty</span> = <span class="ruby-identifier">globalize_type</span>(<span class="ruby-identifier">rest_ty</span>, <span class="ruby-identifier">env</span>, <span class="ruby-identifier">ep</span>)
        <span class="ruby-keyword">if</span> <span class="ruby-identifier">ty</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Type</span><span class="ruby-operator">::</span><span class="ruby-constant">Array</span>)
          <span class="ruby-identifier">_</span>, (<span class="ruby-identifier">ty</span>,) = <span class="ruby-identifier">ty</span>.<span class="ruby-identifier">elems</span>.<span class="ruby-identifier">take_last</span>(<span class="ruby-value">1</span>)
          <span class="ruby-identifier">kw_tys</span> = <span class="ruby-identifier">type_to_keywords</span>(<span class="ruby-identifier">ty</span>, <span class="ruby-identifier">ep</span>)
        <span class="ruby-keyword">else</span>
          <span class="ruby-identifier">raise</span> <span class="ruby-constant">NotImplementedError</span>
        <span class="ruby-keyword">end</span>
      <span class="ruby-keyword">else</span>
        <span class="ruby-identifier">kw_tys</span> = {}
      <span class="ruby-keyword">end</span>
    <span class="ruby-keyword">end</span>
    <span class="ruby-identifier">aargs</span> = <span class="ruby-constant">ActualArguments</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">aargs</span>, <span class="ruby-identifier">rest_ty</span>, <span class="ruby-identifier">kw_tys</span>, <span class="ruby-identifier">blk_ty</span>)
  <span class="ruby-keyword">elsif</span> <span class="ruby-identifier">flag_args_kw_splat</span>
    <span class="ruby-identifier">last</span> = <span class="ruby-identifier">aargs</span>.<span class="ruby-identifier">last</span>
    <span class="ruby-comment"># XXX: The types contained in ActualArguments are expected to be all local types.</span>
    <span class="ruby-comment"># This &quot;globalize_type&quot; breaks the invariant, and violates the assertion of Union#globalize that asserts @elems be nil.</span>
    <span class="ruby-comment"># To fix this issue fundamentally, ActualArguments should keep all arguments as-is (as like the VM does),</span>
    <span class="ruby-comment"># and globalize some types on the on-demand bases.</span>
    <span class="ruby-identifier">ty</span> = <span class="ruby-identifier">globalize_type</span>(<span class="ruby-identifier">last</span>, <span class="ruby-identifier">env</span>, <span class="ruby-identifier">ep</span>)
    <span class="ruby-keyword">case</span> <span class="ruby-identifier">ty</span>
    <span class="ruby-keyword">when</span> <span class="ruby-constant">Type</span><span class="ruby-operator">::</span><span class="ruby-constant">Hash</span>
      <span class="ruby-identifier">aargs</span> = <span class="ruby-identifier">aargs</span>[<span class="ruby-value">0</span><span class="ruby-operator">..</span><span class="ruby-value">-2</span>]
      <span class="ruby-identifier">kw_tys</span> = <span class="ruby-identifier">ty</span>.<span class="ruby-identifier">elems</span>.<span class="ruby-identifier">to_keywords</span>
    <span class="ruby-keyword">when</span> <span class="ruby-constant">Type</span><span class="ruby-operator">::</span><span class="ruby-constant">Union</span>
      <span class="ruby-identifier">hash_elems</span> = <span class="ruby-keyword">nil</span>
      <span class="ruby-identifier">ty</span>.<span class="ruby-identifier">elems</span>&amp;.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span>(<span class="ruby-identifier">container_kind</span>, <span class="ruby-identifier">base_type</span>), <span class="ruby-identifier">elems</span><span class="ruby-operator">|</span>
        <span class="ruby-keyword">if</span> <span class="ruby-identifier">container_kind</span> <span class="ruby-operator">==</span> <span class="ruby-constant">Type</span><span class="ruby-operator">::</span><span class="ruby-constant">Hash</span>
          <span class="ruby-identifier">hash_elems</span> = <span class="ruby-identifier">hash_elems</span> <span class="ruby-operator">?</span> <span class="ruby-identifier">hash_elems</span>.<span class="ruby-identifier">union</span>(<span class="ruby-identifier">elems</span>) <span class="ruby-operator">:</span> <span class="ruby-identifier">elems</span>
        <span class="ruby-keyword">end</span>
      <span class="ruby-keyword">end</span>
      <span class="ruby-keyword">if</span> <span class="ruby-identifier">hash_elems</span>
        <span class="ruby-identifier">kw_tys</span> = <span class="ruby-identifier">hash_elems</span>.<span class="ruby-identifier">to_keywords</span>
      <span class="ruby-keyword">else</span>
        <span class="ruby-identifier">kw_tys</span> = { <span class="ruby-keyword">nil</span> <span class="ruby-operator">=&gt;</span> <span class="ruby-constant">Type</span>.<span class="ruby-identifier">any</span> }
      <span class="ruby-keyword">end</span>
    <span class="ruby-keyword">when</span> <span class="ruby-constant">Type</span><span class="ruby-operator">::</span><span class="ruby-constant">Any</span>
      <span class="ruby-identifier">aargs</span> = <span class="ruby-identifier">aargs</span>[<span class="ruby-value">0</span><span class="ruby-operator">..</span><span class="ruby-value">-2</span>]
      <span class="ruby-identifier">kw_tys</span> = { <span class="ruby-keyword">nil</span> <span class="ruby-operator">=&gt;</span> <span class="ruby-constant">Type</span>.<span class="ruby-identifier">any</span> }
    <span class="ruby-keyword">else</span>
      <span class="ruby-identifier">warn</span>(<span class="ruby-identifier">ep</span>, <span class="ruby-string">&quot;non hash is passed to **kwarg?&quot;</span>)
      <span class="ruby-identifier">kw_tys</span> = { <span class="ruby-keyword">nil</span> <span class="ruby-operator">=&gt;</span> <span class="ruby-constant">Type</span>.<span class="ruby-identifier">any</span> }
    <span class="ruby-keyword">end</span>
    <span class="ruby-identifier">aargs</span> = <span class="ruby-constant">ActualArguments</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">aargs</span>, <span class="ruby-keyword">nil</span>, <span class="ruby-identifier">kw_tys</span>, <span class="ruby-identifier">blk_ty</span>)
  <span class="ruby-keyword">elsif</span> <span class="ruby-identifier">flag_args_kwarg</span>
    <span class="ruby-identifier">kw_vals</span> = <span class="ruby-identifier">aargs</span>.<span class="ruby-identifier">pop</span>(<span class="ruby-identifier">kw_arg</span>.<span class="ruby-identifier">size</span>)

    <span class="ruby-identifier">kw_tys</span> = {}
    <span class="ruby-identifier">kw_arg</span>.<span class="ruby-identifier">zip</span>(<span class="ruby-identifier">kw_vals</span>) <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">key</span>, <span class="ruby-identifier">v_ty</span><span class="ruby-operator">|</span>
      <span class="ruby-identifier">kw_tys</span>[<span class="ruby-identifier">key</span>] = <span class="ruby-identifier">v_ty</span>
    <span class="ruby-keyword">end</span>

    <span class="ruby-identifier">aargs</span> = <span class="ruby-constant">ActualArguments</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">aargs</span>, <span class="ruby-keyword">nil</span>, <span class="ruby-identifier">kw_tys</span>, <span class="ruby-identifier">blk_ty</span>)
  <span class="ruby-keyword">else</span>
    <span class="ruby-identifier">aargs</span> = <span class="ruby-constant">ActualArguments</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">aargs</span>, <span class="ruby-keyword">nil</span>, {}, <span class="ruby-identifier">blk_ty</span>)
  <span class="ruby-keyword">end</span>

  <span class="ruby-keyword">if</span> <span class="ruby-identifier">blk_iseq</span>
    <span class="ruby-comment"># pending dummy execution</span>
    <span class="ruby-identifier">nctx</span> = <span class="ruby-constant">Context</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">blk_iseq</span>, <span class="ruby-identifier">ep</span>.<span class="ruby-identifier">ctx</span>.<span class="ruby-identifier">cref</span>, <span class="ruby-identifier">ep</span>.<span class="ruby-identifier">ctx</span>.<span class="ruby-identifier">mid</span>)
    <span class="ruby-identifier">nep</span> = <span class="ruby-constant">ExecutionPoint</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">nctx</span>, <span class="ruby-value">0</span>, <span class="ruby-identifier">ep</span>)
    <span class="ruby-identifier">nlocals</span> = [<span class="ruby-constant">Type</span>.<span class="ruby-identifier">any</span>] <span class="ruby-operator">*</span> <span class="ruby-identifier">blk_iseq</span>.<span class="ruby-identifier">locals</span>.<span class="ruby-identifier">size</span>
    <span class="ruby-identifier">nsenv</span> = <span class="ruby-constant">StaticEnv</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">env</span>.<span class="ruby-identifier">static_env</span>.<span class="ruby-identifier">recv_ty</span>, <span class="ruby-constant">Type</span>.<span class="ruby-identifier">any</span>, <span class="ruby-identifier">env</span>.<span class="ruby-identifier">static_env</span>.<span class="ruby-identifier">mod_func</span>, <span class="ruby-identifier">env</span>.<span class="ruby-identifier">static_env</span>.<span class="ruby-identifier">pub_meth</span>)
    <span class="ruby-identifier">nenv</span> = <span class="ruby-constant">Env</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">nsenv</span>, <span class="ruby-identifier">nlocals</span>, [], <span class="ruby-keyword">nil</span>)
    <span class="ruby-identifier">pend_block_dummy_execution</span>(<span class="ruby-identifier">blk_ty</span>, <span class="ruby-identifier">blk_iseq</span>, <span class="ruby-identifier">nep</span>, <span class="ruby-identifier">nenv</span>)
    <span class="ruby-identifier">merge_return_env</span>(<span class="ruby-identifier">ep</span>) {<span class="ruby-operator">|</span><span class="ruby-identifier">tenv</span><span class="ruby-operator">|</span> <span class="ruby-identifier">tenv</span> <span class="ruby-operator">?</span> <span class="ruby-identifier">tenv</span>.<span class="ruby-identifier">merge</span>(<span class="ruby-identifier">env</span>) <span class="ruby-operator">:</span> <span class="ruby-identifier">env</span> }
  <span class="ruby-keyword">end</span>

  <span class="ruby-identifier">aargs</span>.<span class="ruby-identifier">node_id</span> = <span class="ruby-identifier">opt</span>[<span class="ruby-value">:node_id</span>]

  <span class="ruby-keyword">return</span> <span class="ruby-identifier">env</span>, <span class="ruby-identifier">recv</span>, <span class="ruby-identifier">mid</span>, <span class="ruby-identifier">aargs</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-type_to_keywords" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">type_to_keywords</span><span
                                class="method-args">(ty, ep)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="type_to_keywords-source">
            <pre><span class="ruby-comment"># File typeprof-0.21.8/lib/typeprof/analyzer.rb, line 2239</span>
        <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">type_to_keywords</span>(<span class="ruby-identifier">ty</span>, <span class="ruby-identifier">ep</span>)
  <span class="ruby-keyword">case</span> <span class="ruby-identifier">ty</span>
  <span class="ruby-keyword">when</span> <span class="ruby-constant">Type</span><span class="ruby-operator">::</span><span class="ruby-constant">Hash</span>
    <span class="ruby-identifier">ty</span>.<span class="ruby-identifier">elems</span>.<span class="ruby-identifier">to_keywords</span>
  <span class="ruby-keyword">when</span> <span class="ruby-constant">Type</span><span class="ruby-operator">::</span><span class="ruby-constant">Union</span>
    <span class="ruby-identifier">hash_elems</span> = <span class="ruby-keyword">nil</span>
    <span class="ruby-identifier">ty</span>.<span class="ruby-identifier">elems</span>&amp;.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span>(<span class="ruby-identifier">container_kind</span>, <span class="ruby-identifier">base_type</span>), <span class="ruby-identifier">elems</span><span class="ruby-operator">|</span>
      <span class="ruby-keyword">if</span> <span class="ruby-identifier">container_kind</span> <span class="ruby-operator">==</span> <span class="ruby-constant">Type</span><span class="ruby-operator">::</span><span class="ruby-constant">Hash</span>
        <span class="ruby-identifier">elems</span>.<span class="ruby-identifier">to_keywords</span>
        <span class="ruby-identifier">hash_elems</span> = <span class="ruby-identifier">hash_elems</span> <span class="ruby-operator">?</span> <span class="ruby-identifier">hash_elems</span>.<span class="ruby-identifier">union</span>(<span class="ruby-identifier">elems</span>) <span class="ruby-operator">:</span> <span class="ruby-identifier">elems</span>
      <span class="ruby-keyword">end</span>
    <span class="ruby-keyword">end</span>
    <span class="ruby-keyword">if</span> <span class="ruby-identifier">hash_elems</span>
      <span class="ruby-identifier">hash_elems</span>.<span class="ruby-identifier">to_keywords</span>
    <span class="ruby-keyword">else</span>
      { <span class="ruby-keyword">nil</span> <span class="ruby-operator">=&gt;</span> <span class="ruby-constant">Type</span>.<span class="ruby-identifier">any</span> }
    <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">else</span>
    <span class="ruby-identifier">warn</span>(<span class="ruby-identifier">ep</span>, <span class="ruby-string">&quot;non hash is passed to **kwarg?&quot;</span>) <span class="ruby-keyword">unless</span> <span class="ruby-identifier">ty</span> <span class="ruby-operator">==</span> <span class="ruby-constant">Type</span>.<span class="ruby-identifier">any</span>
    { <span class="ruby-keyword">nil</span> <span class="ruby-operator">=&gt;</span> <span class="ruby-constant">Type</span>.<span class="ruby-identifier">any</span> }
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                          </section>

              </section>
              </main>



            </div>  <!--  class='wrapper hdiv' -->


<footer id="validator-badges" role="contentinfo">
<p><a href="https://validator.w3.org/check/referer">Validate</a></p>
<p>Generated by <a href="https://ruby.github.io/rdoc/">RDoc</a> 6.4.0.</p>
<p>Based on <a href="https://github.com/ged/darkfish/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.</p>

  
    <p><p><a href="https://ruby-doc.org">Ruby-doc.org</a> is a service of <a href="https://jamesbritt.com">James Britt</a> and <a href="https://neurogami.com">Neurogami</a>, purveyors of fine <a href='https://jamesbritt.bandcamp.com/'>dance noise</a></p>
</p>
  
  </footer>

<script type="text/javascript">


  let ads  = $("#carbonads-container").children().detach();


  function swapMode() {
    var cookieName = 'darkmode';
    var cssDarkmode = Cookies.get(cookieName);
    console.log("***** swapMode! " + cssDarkmode + " *****");


    if (cssDarkmode == "true") {
      console.log("We have dark mode, set the css to light ...");
      $('#rdoccss').attr("href", defaultModeCssHref);
      $('#cssSelect').text("Dark mode");
      cssDarkmode = "false";
      console.log("swapMode! Now set cookie to " + cssDarkmode);
      Cookies.set(cookieName, cssDarkmode);

    } else {
      console.log("We not have dark mode, set the css to dark ...");
      $('#rdoccss').attr("href", darkModeCsseHref);
      $('#cssSelect').text("Light mode");
      cssDarkmode = "true";
      console.log("swapMode! Now set cookie to " + cssDarkmode);
      Cookies.set(cookieName, cssDarkmode);

    }

    console.log("  --------------- ");
  }


const vueCssApp = new Vue({
el: '#menubar',
data: {
isDark: false
},
methods: {
toggleClass: function(event){
this.isDark = !this.isDark;
}
}
})

const vueApp = new Vue({
el: '#vapp',
data: { 
isOpen: true
},

mounted() {
this.handleResize();
this.manage_mob_classes();
window.addEventListener('resize', this.handleResize)
//this.isOpen !=  (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent));
},
destroyed() {
window.removeEventListener('resize', this.handleResize)
},
created() {
//manage_mob_classes();
},

methods : {
isMobile() {
  return (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent));
},

  handleResize() {
    if (!this.isMobile()) {
      this.isOpen = window.innerWidth > 800;
    }
  },

  manage_mob_classes() {
    if (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)) {
      $("nav").addClass("mob_nav");
      $("main").addClass("mob_main");
      $("#extraz").addClass("mob_extraz");
      $("#carbonads-container").addClass("mob_carbonads-container");
      this.isOpen  = false;
    } else {
      $("nav").removeClass("mob_nav") 
        $("main").removeClass("mob_main");
      $("#extraz").removeClass("mob_extraz");
      $("#carbonads-container").removeClass("mob_carbonads-container");
      this.isOpen  = true;
    }
  },

  toggleNav() {
    this.isOpen =! this.isOpen ;
    // alert("Toggle nav!");
    console.log("toggleNav() click: " + this.isOpen );
  }
}
})

$("#carbonads-container").append(ads);


$(function() {

    var darkmode = Cookies.get("darkmode");
    console.log("Document ready: " + darkmode);

    if ( darkmode  == "true" ) {
      $('#cssSelect').text("Light mode");
    } else {
      $('#cssSelect').text("Dark mode");
     }

    $('body').css('display','block');
    });

</script>

    
  </body> 
</html>

